Panda3D
|
This is a collection of polygons; i.e. More...
#include "xFileMesh.h"
Classes | |
class | SkinWeightsData |
Public Member Functions | |
XFileMesh (CoordinateSystem cs=CS_yup_left) | |
int | add_material (EggPrimitive *egg_prim) |
Creates a new XFileMaterial, if one does not already exist for the indicated material, and returns its index. | |
int | add_material (XFileMaterial *material) |
Adds the newly-created XFileMaterial unequivocally to the mesh, returning its index number. | |
int | add_normal (EggVertex *egg_vertex, EggPrimitive *egg_prim) |
Creates a new XFileNormal, if one does not already exist for the indicated normal, and returns its index. | |
int | add_normal (XFileNormal *normal) |
Adds the newly-created XFileNormal unequivocally to the mesh, returning its index number. | |
void | add_polygon (EggPolygon *egg_poly) |
Adds the indicated polygon to the mesh. | |
int | add_vertex (EggVertex *egg_vertex, EggPrimitive *egg_prim) |
Creates a new XFileVertex, if one does not already exist for the indicated vertex, and returns its index. | |
int | add_vertex (XFileVertex *vertex) |
Adds the newly-created XFileVertex unequivocally to the mesh, returning its index number. | |
void | clear () |
Empties all data from the mesh. | |
bool | create_polygons (XFileToEggConverter *converter) |
Creates a slew of EggPolygons according to the faces in the mesh, and adds them to the previously-indicated parent node. | |
bool | fill_colors (XFileDataNode *obj) |
Fills the structure based on the raw data from the MeshVertexColors template. | |
bool | fill_material_list (XFileDataNode *obj) |
Fills the structure based on the raw data from the MeshMaterialList template. | |
bool | fill_mesh (XFileDataNode *obj) |
Fills the structure based on the raw data from the X file's Mesh object. | |
bool | fill_mesh_child (XFileDataNode *obj) |
Fills the structure based on one of the children of the Mesh object. | |
bool | fill_normals (XFileDataNode *obj) |
Fills the structure based on the raw data from the MeshNormals template. | |
bool | fill_skin_weights (XFileDataNode *obj) |
Fills the structure based on the raw data from the SkinWeights template. | |
bool | fill_uvs (XFileDataNode *obj) |
Fills the structure based on the raw data from the MeshTextureCoords template. | |
XFileMaterial * | get_material (int n) const |
Returns a pointer to the nth materials associated with the mesh. | |
int | get_num_materials () const |
Returns the number of distinct materials associated with the mesh. | |
bool | has_colors () const |
Returns true if any of the vertices or faces added to this mesh used a color, false otherwise. | |
bool | has_materials () const |
Returns true if any of the faces added to this mesh used a real material, false otherwise. | |
bool | has_normals () const |
Returns true if any of the vertices or faces added to this mesh used a normal, false otherwise. | |
bool | has_uvs () const |
Returns true if any of the vertices added to this mesh used a texture coordinate, false otherwise. | |
XFileDataNode * | make_x_colors (XFileNode *x_mesh, const string &suffix) |
Creates a MeshVertexColors table for the mesh. | |
XFileDataNode * | make_x_material_list (XFileNode *x_mesh, const string &suffix) |
Creates a MeshMaterialList table for the mesh. | |
XFileDataNode * | make_x_mesh (XFileNode *x_parent, const string &suffix) |
Creates an X structure corresponding to the mesh. | |
XFileDataNode * | make_x_normals (XFileNode *x_mesh, const string &suffix) |
Creates a MeshNormals table for the mesh. | |
XFileDataNode * | make_x_uvs (XFileNode *x_mesh, const string &suffix) |
Creates a MeshTextureCoords table for the mesh. | |
void | set_egg_parent (EggGroupNode *egg_parent) |
Specifies the egg node that will eventually be the parent of this mesh, when create_polygons() is later called. |
int XFileMesh::add_material | ( | EggPrimitive * | egg_prim | ) |
Creates a new XFileMaterial, if one does not already exist for the indicated material, and returns its index.
Definition at line 181 of file xFileMesh.cxx.
References XFileMaterial::has_material(), and XFileMaterial::set_from_egg().
Referenced by fill_material_list(), and XFileFace::set_from_egg().
int XFileMesh::add_material | ( | XFileMaterial * | material | ) |
Adds the newly-created XFileMaterial unequivocally to the mesh, returning its index number.
The XFileMesh object becomes the owner of the XFileMaterial pointer, and will delete it when it destructs.
Definition at line 246 of file xFileMesh.cxx.
int XFileMesh::add_normal | ( | EggVertex * | egg_vertex, |
EggPrimitive * | egg_prim | ||
) |
Creates a new XFileNormal, if one does not already exist for the indicated normal, and returns its index.
Definition at line 150 of file xFileMesh.cxx.
References XFileNormal::set_from_egg().
Referenced by fill_normals(), and XFileFace::set_from_egg().
int XFileMesh::add_normal | ( | XFileNormal * | normal | ) |
Adds the newly-created XFileNormal unequivocally to the mesh, returning its index number.
The XFileMesh object becomes the owner of the XFileNormal pointer, and will delete it when it destructs.
Definition at line 230 of file xFileMesh.cxx.
void XFileMesh::add_polygon | ( | EggPolygon * | egg_poly | ) |
Adds the indicated polygon to the mesh.
Definition at line 101 of file xFileMesh.cxx.
References XFileFace::set_from_egg().
int XFileMesh::add_vertex | ( | EggVertex * | egg_vertex, |
EggPrimitive * | egg_prim | ||
) |
Creates a new XFileVertex, if one does not already exist for the indicated vertex, and returns its index.
Definition at line 115 of file xFileMesh.cxx.
References XFileVertex::set_from_egg().
Referenced by fill_mesh(), and XFileFace::set_from_egg().
int XFileMesh::add_vertex | ( | XFileVertex * | vertex | ) |
Adds the newly-created XFileVertex unequivocally to the mesh, returning its index number.
The XFileMesh object becomes the owner of the XFileVertex pointer, and will delete it when it destructs.
Definition at line 214 of file xFileMesh.cxx.
void XFileMesh::clear | ( | void | ) |
Empties all data from the mesh.
Definition at line 58 of file xFileMesh.cxx.
Referenced by fill_mesh().
bool XFileMesh::create_polygons | ( | XFileToEggConverter * | converter | ) |
Creates a slew of EggPolygons according to the faces in the mesh, and adds them to the previously-indicated parent node.
Definition at line 277 of file xFileMesh.cxx.
References EggGroupNode::add_child(), EggPrimitive::add_vertex(), XFileMaterial::apply_to_egg(), EggVertexPool::begin(), EggVertexPool::create_unique_vertex(), EggVertexPool::end(), XFileToEggConverter::find_joint(), EggVertex::get_external_index(), EggNode::get_node_to_vertex(), has_normals(), EggGroupNode::recompute_vertex_normals(), EggGroup::ref_vertex(), EggVertex::set_external_index(), EggVertex::set_pos(), EggVertex::set_uv(), and EggVertex::transform().
bool XFileMesh::fill_colors | ( | XFileDataNode * | obj | ) |
Fills the structure based on the raw data from the MeshVertexColors template.
Definition at line 799 of file xFileMesh.cxx.
References XFileDataObject::i(), and XFileDataObject::size().
Referenced by fill_mesh_child().
bool XFileMesh::fill_material_list | ( | XFileDataNode * | obj | ) |
Fills the structure based on the raw data from the MeshMaterialList template.
Definition at line 893 of file xFileMesh.cxx.
References add_material(), XFileMaterial::fill_material(), XFileNode::get_num_objects(), XFileNode::get_object(), XFileDataNode::get_template_name(), XFileDataObject::i(), XFileDataNode::is_standard_object(), and XFileDataObject::size().
Referenced by fill_mesh_child().
bool XFileMesh::fill_mesh | ( | XFileDataNode * | obj | ) |
Fills the structure based on the raw data from the X file's Mesh object.
Definition at line 660 of file xFileMesh.cxx.
References add_vertex(), clear(), fill_mesh_child(), XFileNode::get_num_objects(), XFileNode::get_object(), XFileDataObject::i(), XFileDataObject::size(), and XFileDataObject::vec3().
bool XFileMesh::fill_mesh_child | ( | XFileDataNode * | obj | ) |
Fills the structure based on one of the children of the Mesh object.
Definition at line 706 of file xFileMesh.cxx.
References fill_colors(), fill_material_list(), fill_normals(), fill_skin_weights(), fill_uvs(), XFileDataNode::get_template_name(), and XFileDataNode::is_standard_object().
Referenced by fill_mesh().
bool XFileMesh::fill_normals | ( | XFileDataNode * | obj | ) |
Fills the structure based on the raw data from the MeshNormals template.
Definition at line 753 of file xFileMesh.cxx.
References add_normal(), XFileDataObject::i(), XFileDataObject::size(), and XFileDataObject::vec3().
Referenced by fill_mesh_child().
bool XFileMesh::fill_skin_weights | ( | XFileDataNode * | obj | ) |
Fills the structure based on the raw data from the SkinWeights template.
Definition at line 850 of file xFileMesh.cxx.
References XFileDataObject::d(), XFileDataObject::i(), and XFileDataObject::size().
Referenced by fill_mesh_child().
bool XFileMesh::fill_uvs | ( | XFileDataNode * | obj | ) |
Fills the structure based on the raw data from the MeshTextureCoords template.
Definition at line 825 of file xFileMesh.cxx.
References XFileDataObject::size(), and XFileDataObject::vec2().
Referenced by fill_mesh_child().
XFileMaterial * XFileMesh::get_material | ( | int | n | ) | const |
Returns a pointer to the nth materials associated with the mesh.
Definition at line 467 of file xFileMesh.cxx.
int XFileMesh::get_num_materials | ( | ) | const |
Returns the number of distinct materials associated with the mesh.
Definition at line 456 of file xFileMesh.cxx.
bool XFileMesh::has_colors | ( | ) | const |
Returns true if any of the vertices or faces added to this mesh used a color, false otherwise.
Definition at line 423 of file xFileMesh.cxx.
Referenced by make_x_mesh().
bool XFileMesh::has_materials | ( | ) | const |
Returns true if any of the faces added to this mesh used a real material, false otherwise.
Definition at line 445 of file xFileMesh.cxx.
Referenced by make_x_mesh().
bool XFileMesh::has_normals | ( | ) | const |
Returns true if any of the vertices or faces added to this mesh used a normal, false otherwise.
Definition at line 412 of file xFileMesh.cxx.
Referenced by create_polygons(), and make_x_mesh().
bool XFileMesh::has_uvs | ( | ) | const |
Returns true if any of the vertices added to this mesh used a texture coordinate, false otherwise.
Definition at line 434 of file xFileMesh.cxx.
Referenced by make_x_mesh().
XFileDataNode * XFileMesh::make_x_colors | ( | XFileNode * | x_mesh, |
const string & | suffix | ||
) |
Creates a MeshVertexColors table for the mesh.
Definition at line 576 of file xFileMesh.cxx.
References XFileDataObject::add_IndexedColor(), XFileNode::add_MeshVertexColors(), and XFileDataObject::size().
Referenced by make_x_mesh().
XFileDataNode * XFileMesh::make_x_material_list | ( | XFileNode * | x_mesh, |
const string & | suffix | ||
) |
Creates a MeshMaterialList table for the mesh.
Definition at line 623 of file xFileMesh.cxx.
References XFileDataObject::add_int(), XFileNode::add_MeshMaterialList(), XFileMaterial::make_x_material(), and XFileDataObject::size().
Referenced by make_x_mesh().
XFileDataNode * XFileMesh::make_x_mesh | ( | XFileNode * | x_parent, |
const string & | suffix | ||
) |
Creates an X structure corresponding to the mesh.
Definition at line 478 of file xFileMesh.cxx.
References XFileDataObject::add_int(), XFileNode::add_Mesh(), XFileDataObject::add_MeshFace(), XFileDataObject::add_Vector(), has_colors(), has_materials(), has_normals(), has_uvs(), make_x_colors(), make_x_material_list(), make_x_normals(), make_x_uvs(), and XFileDataObject::size().
XFileDataNode * XFileMesh::make_x_normals | ( | XFileNode * | x_mesh, |
const string & | suffix | ||
) |
Creates a MeshNormals table for the mesh.
Definition at line 537 of file xFileMesh.cxx.
References XFileDataObject::add_int(), XFileDataObject::add_MeshFace(), XFileNode::add_MeshNormals(), XFileDataObject::add_Vector(), and XFileDataObject::size().
Referenced by make_x_mesh().
XFileDataNode * XFileMesh::make_x_uvs | ( | XFileNode * | x_mesh, |
const string & | suffix | ||
) |
Creates a MeshTextureCoords table for the mesh.
Definition at line 601 of file xFileMesh.cxx.
References XFileDataObject::add_Coords2d(), XFileNode::add_MeshTextureCoords(), and XFileDataObject::size().
Referenced by make_x_mesh().
void XFileMesh::set_egg_parent | ( | EggGroupNode * | egg_parent | ) |
Specifies the egg node that will eventually be the parent of this mesh, when create_polygons() is later called.
Definition at line 261 of file xFileMesh.cxx.
References EggGroupNode::add_child().