Panda3D
|
This is a collection of polygons; i.e. More...
#include "xFileMesh.h"
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. More... | |
int | add_material (XFileMaterial *material) |
Adds the newly-created XFileMaterial unequivocally to the mesh, returning its index number. More... | |
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. More... | |
int | add_normal (XFileNormal *normal) |
Adds the newly-created XFileNormal unequivocally to the mesh, returning its index number. More... | |
void | add_polygon (EggPolygon *egg_poly) |
Adds the indicated polygon to the mesh. More... | |
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. More... | |
int | add_vertex (XFileVertex *vertex) |
Adds the newly-created XFileVertex unequivocally to the mesh, returning its index number. More... | |
void | clear () |
Empties all data from the mesh. More... | |
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. More... | |
bool | fill_colors (XFileDataNode *obj) |
Fills the structure based on the raw data from the MeshVertexColors template. More... | |
bool | fill_material_list (XFileDataNode *obj) |
Fills the structure based on the raw data from the MeshMaterialList template. More... | |
bool | fill_mesh (XFileDataNode *obj) |
Fills the structure based on the raw data from the X file's Mesh object. More... | |
bool | fill_mesh_child (XFileDataNode *obj) |
Fills the structure based on one of the children of the Mesh object. More... | |
bool | fill_normals (XFileDataNode *obj) |
Fills the structure based on the raw data from the MeshNormals template. More... | |
bool | fill_skin_weights (XFileDataNode *obj) |
Fills the structure based on the raw data from the SkinWeights template. More... | |
bool | fill_uvs (XFileDataNode *obj) |
Fills the structure based on the raw data from the MeshTextureCoords template. More... | |
XFileMaterial * | get_material (int n) const |
Returns a pointer to the nth materials associated with the mesh. More... | |
int | get_num_materials () const |
Returns the number of distinct materials associated with the mesh. More... | |
bool | has_colors () const |
Returns true if any of the vertices or faces added to this mesh used a color, false otherwise. More... | |
bool | has_materials () const |
Returns true if any of the faces added to this mesh used a real material, false otherwise. More... | |
bool | has_normals () const |
Returns true if any of the vertices or faces added to this mesh used a normal, false otherwise. More... | |
bool | has_uvs () const |
Returns true if any of the vertices added to this mesh used a texture coordinate, false otherwise. More... | |
XFileDataNode * | make_x_colors (XFileNode *x_mesh, const string &suffix) |
Creates a MeshVertexColors table for the mesh. More... | |
XFileDataNode * | make_x_material_list (XFileNode *x_mesh, const string &suffix) |
Creates a MeshMaterialList table for the mesh. More... | |
XFileDataNode * | make_x_mesh (XFileNode *x_parent, const string &suffix) |
Creates an X structure corresponding to the mesh. More... | |
XFileDataNode * | make_x_normals (XFileNode *x_mesh, const string &suffix) |
Creates a MeshNormals table for the mesh. More... | |
XFileDataNode * | make_x_uvs (XFileNode *x_mesh, const string &suffix) |
Creates a MeshTextureCoords table for the mesh. More... | |
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. More... | |
![]() | |
Namable (const string &initial_name="") | |
Namable (const Namable ©) | |
void | clear_name () |
Resets the Namable's name to empty. More... | |
const string & | get_name () const |
bool | has_name () const |
Returns true if the Namable has a nonempty name set, false if the name is empty. More... | |
Namable & | operator= (const Namable &other) |
void | output (ostream &out) const |
Outputs the Namable. More... | |
void | set_name (const string &name) |
Additional Inherited Members | |
![]() | |
static TypeHandle | get_class_type () |
static void | init_type () |
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 add_vertex(), XFileMaterial::has_material(), and XFileMaterial::set_from_egg().
Referenced by add_normal(), 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 257 of file xFileMesh.cxx.
References XFileMaterial::has_material(), and set_egg_parent().
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 add_material(), and XFileNormal::set_from_egg().
Referenced by add_vertex(), 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 237 of file xFileMesh.cxx.
References add_material().
void XFileMesh::add_polygon | ( | EggPolygon * | egg_poly | ) |
Adds the indicated polygon to the mesh.
Definition at line 101 of file xFileMesh.cxx.
References add_vertex(), and XFileFace::set_from_egg().
Referenced by XFileMaker::add_tree(), and clear().
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 add_normal(), and XFileVertex::set_from_egg().
Referenced by add_material(), add_polygon(), 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.
References add_normal().
void XFileMesh::clear | ( | void | ) |
Empties all data from the mesh.
Definition at line 58 of file xFileMesh.cxx.
References add_polygon().
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 292 of file xFileMesh.cxx.
References 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(), EggGroup::ref_vertex(), EggVertex::set_external_index(), EggVertex::set_pos(), EggVertex::set_uv(), and EggVertex::transform().
Referenced by set_egg_parent().
bool XFileMesh::fill_colors | ( | XFileDataNode * | obj | ) |
Fills the structure based on the raw data from the MeshVertexColors template.
Definition at line 814 of file xFileMesh.cxx.
References fill_uvs(), XFileDataObject::i(), and XFileDataObject::size().
Referenced by fill_normals().
bool XFileMesh::fill_material_list | ( | XFileDataNode * | obj | ) |
Fills the structure based on the raw data from the MeshMaterialList template.
Definition at line 908 of file xFileMesh.cxx.
References 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_skin_weights().
bool XFileMesh::fill_mesh | ( | XFileDataNode * | obj | ) |
Fills the structure based on the raw data from the X file's Mesh object.
Definition at line 675 of file xFileMesh.cxx.
References fill_mesh_child(), XFileNode::get_num_objects(), XFileNode::get_object(), XFileDataObject::i(), XFileDataObject::size(), and XFileDataObject::vec3().
Referenced by XFileToEggConverter::find_joint(), and make_x_material_list().
bool XFileMesh::fill_mesh_child | ( | XFileDataNode * | obj | ) |
Fills the structure based on one of the children of the Mesh object.
Definition at line 721 of file xFileMesh.cxx.
References fill_normals(), 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 768 of file xFileMesh.cxx.
References fill_colors(), 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 865 of file xFileMesh.cxx.
References XFileDataObject::d(), fill_material_list(), XFileDataObject::i(), and XFileDataObject::size().
Referenced by fill_uvs().
bool XFileMesh::fill_uvs | ( | XFileDataNode * | obj | ) |
Fills the structure based on the raw data from the MeshTextureCoords template.
Definition at line 840 of file xFileMesh.cxx.
References fill_skin_weights(), XFileDataObject::size(), and XFileDataObject::vec2().
Referenced by fill_colors().
XFileMaterial * XFileMesh::get_material | ( | int | n | ) | const |
Returns a pointer to the nth materials associated with the mesh.
Definition at line 482 of file xFileMesh.cxx.
References make_x_mesh().
Referenced by get_num_materials().
int XFileMesh::get_num_materials | ( | ) | const |
Returns the number of distinct materials associated with the mesh.
Definition at line 471 of file xFileMesh.cxx.
References get_material().
Referenced by has_materials().
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 438 of file xFileMesh.cxx.
References has_uvs().
Referenced by has_normals().
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 460 of file xFileMesh.cxx.
References get_num_materials().
Referenced by has_uvs().
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 427 of file xFileMesh.cxx.
References has_colors().
Referenced by create_polygons().
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 449 of file xFileMesh.cxx.
References has_materials().
Referenced by has_colors().
XFileDataNode * XFileMesh::make_x_colors | ( | XFileNode * | x_mesh, |
const string & | suffix | ||
) |
Creates a MeshVertexColors table for the mesh.
Definition at line 591 of file xFileMesh.cxx.
References XFileDataObject::add_IndexedColor(), XFileNode::add_MeshVertexColors(), make_x_uvs(), and XFileDataObject::size().
Referenced by make_x_normals().
XFileDataNode * XFileMesh::make_x_material_list | ( | XFileNode * | x_mesh, |
const string & | suffix | ||
) |
Creates a MeshMaterialList table for the mesh.
Definition at line 638 of file xFileMesh.cxx.
References XFileDataObject::add_int(), XFileNode::add_MeshMaterialList(), fill_mesh(), XFileMaterial::make_x_material(), and XFileDataObject::size().
Referenced by make_x_uvs().
XFileDataNode * XFileMesh::make_x_mesh | ( | XFileNode * | x_parent, |
const string & | suffix | ||
) |
Creates an X structure corresponding to the mesh.
Definition at line 493 of file xFileMesh.cxx.
References XFileDataObject::add_int(), XFileNode::add_Mesh(), XFileDataObject::add_MeshFace(), XFileDataObject::add_Vector(), make_x_normals(), and XFileDataObject::size().
Referenced by XFileMaker::add_tree(), and get_material().
XFileDataNode * XFileMesh::make_x_normals | ( | XFileNode * | x_mesh, |
const string & | suffix | ||
) |
Creates a MeshNormals table for the mesh.
Definition at line 552 of file xFileMesh.cxx.
References XFileDataObject::add_int(), XFileDataObject::add_MeshFace(), XFileNode::add_MeshNormals(), XFileDataObject::add_Vector(), make_x_colors(), 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 616 of file xFileMesh.cxx.
References XFileDataObject::add_Coords2d(), XFileNode::add_MeshTextureCoords(), make_x_material_list(), and XFileDataObject::size().
Referenced by make_x_colors().
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 276 of file xFileMesh.cxx.
References EggGroupNode::add_child(), and create_polygons().
Referenced by add_material(), and XFileToEggConverter::find_joint().