Panda3D
Classes | Public Member Functions | List of all members
XFileMesh Class Reference

This is a collection of polygons; i.e. More...

#include "xFileMesh.h"

Inheritance diagram for XFileMesh:
Namable MemoryBase

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...
 
XFileMaterialget_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...
 
XFileDataNodemake_x_colors (XFileNode *x_mesh, const std::string &suffix)
 Creates a MeshVertexColors table for the mesh. More...
 
XFileDataNodemake_x_material_list (XFileNode *x_mesh, const std::string &suffix)
 Creates a MeshMaterialList table for the mesh. More...
 
XFileDataNodemake_x_mesh (XFileNode *x_parent, const std::string &suffix)
 Creates an X structure corresponding to the mesh. More...
 
XFileDataNodemake_x_normals (XFileNode *x_mesh, const std::string &suffix)
 Creates a MeshNormals table for the mesh. More...
 
XFileDataNodemake_x_uvs (XFileNode *x_mesh, const std::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...
 
- Public Member Functions inherited from Namable
 Namable (const std::string &initial_name="")
 
void clear_name ()
 Resets the Namable's name to empty. More...
 
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. More...
 
void output (std::ostream &out) const
 Outputs the Namable. More...
 
void set_name (const std::string &name)
 

Additional Inherited Members

- Static Public Member Functions inherited from Namable
static TypeHandle get_class_type ()
 
static void init_type ()
 
- Public Attributes inherited from Namable
 get_name
 
 set_name
 

Detailed Description

This is a collection of polygons; i.e.

a polyset.

Definition at line 45 of file xFileMesh.h.

Member Function Documentation

◆ add_material() [1/2]

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 168 of file xFileMesh.cxx.

References XFileMaterial::has_material(), and XFileMaterial::set_from_egg().

◆ add_material() [2/2]

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 235 of file xFileMesh.cxx.

References XFileMaterial::has_material().

◆ add_normal() [1/2]

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 140 of file xFileMesh.cxx.

References XFileNormal::set_from_egg().

◆ add_normal() [2/2]

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 218 of file xFileMesh.cxx.

◆ add_polygon()

void XFileMesh::add_polygon ( EggPolygon egg_poly)

Adds the indicated polygon to the mesh.

Definition at line 97 of file xFileMesh.cxx.

References XFileFace::set_from_egg().

◆ add_vertex() [1/2]

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 108 of file xFileMesh.cxx.

References XFileVertex::set_from_egg().

◆ add_vertex() [2/2]

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 198 of file xFileMesh.cxx.

◆ clear()

void XFileMesh::clear ( )

Empties all data from the mesh.

Definition at line 56 of file xFileMesh.cxx.

Referenced by fill_mesh().

◆ create_polygons()

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 264 of file xFileMesh.cxx.

◆ fill_colors()

bool XFileMesh::fill_colors ( XFileDataNode obj)

Fills the structure based on the raw data from the MeshVertexColors template.

Definition at line 750 of file xFileMesh.cxx.

Referenced by fill_mesh_child().

◆ fill_material_list()

bool XFileMesh::fill_material_list ( XFileDataNode obj)

Fills the structure based on the raw data from the MeshMaterialList template.

Definition at line 837 of file xFileMesh.cxx.

References XFileDataObject::size().

Referenced by fill_mesh_child().

◆ fill_mesh()

bool XFileMesh::fill_mesh ( XFileDataNode obj)

Fills the structure based on the raw data from the X file's Mesh object.

Definition at line 619 of file xFileMesh.cxx.

References clear().

◆ fill_mesh_child()

bool XFileMesh::fill_mesh_child ( XFileDataNode obj)

Fills the structure based on one of the children of the Mesh object.

Definition at line 662 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().

◆ fill_normals()

bool XFileMesh::fill_normals ( XFileDataNode obj)

Fills the structure based on the raw data from the MeshNormals template.

Definition at line 706 of file xFileMesh.cxx.

Referenced by fill_mesh_child().

◆ fill_skin_weights()

bool XFileMesh::fill_skin_weights ( XFileDataNode obj)

Fills the structure based on the raw data from the SkinWeights template.

Definition at line 796 of file xFileMesh.cxx.

Referenced by fill_mesh_child().

◆ fill_uvs()

bool XFileMesh::fill_uvs ( XFileDataNode obj)

Fills the structure based on the raw data from the MeshTextureCoords template.

Definition at line 774 of file xFileMesh.cxx.

References XFileDataObject::size().

Referenced by fill_mesh_child().

◆ get_material()

XFileMaterial * XFileMesh::get_material ( int  n) const

Returns a pointer to the nth materials associated with the mesh.

Definition at line 440 of file xFileMesh.cxx.

◆ get_num_materials()

int XFileMesh::get_num_materials ( ) const

Returns the number of distinct materials associated with the mesh.

Definition at line 432 of file xFileMesh.cxx.

◆ has_colors()

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 406 of file xFileMesh.cxx.

◆ has_materials()

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 424 of file xFileMesh.cxx.

◆ has_normals()

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 397 of file xFileMesh.cxx.

◆ has_uvs()

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 415 of file xFileMesh.cxx.

◆ make_x_colors()

XFileDataNode * XFileMesh::make_x_colors ( XFileNode x_mesh,
const std::string &  suffix 
)

Creates a MeshVertexColors table for the mesh.

Definition at line 543 of file xFileMesh.cxx.

References XFileNode::add_MeshVertexColors().

◆ make_x_material_list()

XFileDataNode * XFileMesh::make_x_material_list ( XFileNode x_mesh,
const std::string &  suffix 
)

Creates a MeshMaterialList table for the mesh.

Definition at line 586 of file xFileMesh.cxx.

References XFileDataObject::add_int(), XFileNode::add_MeshMaterialList(), and XFileDataObject::size().

◆ 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 449 of file xFileMesh.cxx.

References XFileNode::add_Mesh().

◆ make_x_normals()

XFileDataNode * XFileMesh::make_x_normals ( XFileNode x_mesh,
const std::string &  suffix 
)

◆ make_x_uvs()

XFileDataNode * XFileMesh::make_x_uvs ( XFileNode x_mesh,
const std::string &  suffix 
)

Creates a MeshTextureCoords table for the mesh.

Definition at line 566 of file xFileMesh.cxx.

References XFileNode::add_MeshTextureCoords().

◆ set_egg_parent()

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 251 of file xFileMesh.cxx.

References EggGroupNode::add_child().


The documentation for this class was generated from the following files: