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. | |
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 std::string &suffix) |
Creates a MeshVertexColors table for the mesh. | |
XFileDataNode * | make_x_material_list (XFileNode *x_mesh, const std::string &suffix) |
Creates a MeshMaterialList table for the mesh. | |
XFileDataNode * | make_x_mesh (XFileNode *x_parent, const std::string &suffix) |
Creates an X structure corresponding to the mesh. | |
XFileDataNode * | make_x_normals (XFileNode *x_mesh, const std::string &suffix) |
Creates a MeshNormals table for the mesh. | |
XFileDataNode * | make_x_uvs (XFileNode *x_mesh, const std::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. | |
![]() | |
Namable (const std::string &initial_name="") | |
void | clear_name () |
Resets the Namable's name to empty. | |
const std::string & | get_name () const |
bool | has_name () const |
Returns true if the Namable has a nonempty name set, false if the name is empty. | |
void | output (std::ostream &out) const |
Outputs the Namable. | |
void | set_name (const std::string &name) |
![]() | |
void | operator delete (void *, void *) |
void | operator delete (void *ptr) |
void | operator delete[] (void *, void *) |
void | operator delete[] (void *ptr) |
void * | operator new (size_t size) |
void * | operator new (size_t size, void *ptr) |
void * | operator new[] (size_t size) |
void * | operator new[] (size_t size, void *ptr) |
Additional Inherited Members | |
![]() | |
static TypeHandle | get_class_type () |
static void | init_type () |
![]() | |
get_name | |
set_name | |
XFileMesh::XFileMesh | ( | CoordinateSystem | cs = CS_yup_left | ) |
Definition at line 35 of file xFileMesh.cxx.
XFileMesh::~XFileMesh | ( | ) |
Definition at line 47 of file xFileMesh.cxx.
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 167 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 234 of file xFileMesh.cxx.
References XFileMaterial::has_material().
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 139 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 217 of file xFileMesh.cxx.
void XFileMesh::add_polygon | ( | EggPolygon * | egg_poly | ) |
Adds the indicated polygon to the mesh.
Definition at line 96 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 107 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 197 of file xFileMesh.cxx.
void XFileMesh::clear | ( | ) |
Empties all data from the mesh.
Definition at line 55 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 263 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 749 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 836 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 618 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 661 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 705 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 795 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 773 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 439 of file xFileMesh.cxx.
int XFileMesh::get_num_materials | ( | ) | const |
Returns the number of distinct materials associated with the mesh.
Definition at line 431 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 405 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 423 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 396 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 414 of file xFileMesh.cxx.
Referenced by make_x_mesh().
XFileDataNode * XFileMesh::make_x_colors | ( | XFileNode * | x_mesh, |
const std::string & | suffix ) |
Creates a MeshVertexColors table for the mesh.
Definition at line 542 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 std::string & | suffix ) |
Creates a MeshMaterialList table for the mesh.
Definition at line 585 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 std::string & | suffix ) |
Creates an X structure corresponding to the mesh.
Definition at line 448 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 std::string & | suffix ) |
Creates a MeshNormals table for the mesh.
Definition at line 505 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 std::string & | suffix ) |
Creates a MeshTextureCoords table for the mesh.
Definition at line 565 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 250 of file xFileMesh.cxx.
References EggGroupNode::add_child().