Panda3D
Loading...
Searching...
No Matches
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.
 
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.
 
XFileMaterialget_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.
 
XFileDataNodemake_x_colors (XFileNode *x_mesh, const std::string &suffix)
 Creates a MeshVertexColors table for the mesh.
 
XFileDataNodemake_x_material_list (XFileNode *x_mesh, const std::string &suffix)
 Creates a MeshMaterialList table for the mesh.
 
XFileDataNodemake_x_mesh (XFileNode *x_parent, const std::string &suffix)
 Creates an X structure corresponding to the mesh.
 
XFileDataNodemake_x_normals (XFileNode *x_mesh, const std::string &suffix)
 Creates a MeshNormals table for the mesh.
 
XFileDataNodemake_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.
 
- Public Member Functions inherited from Namable
 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)
 
- Public Member Functions inherited from MemoryBase
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 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.

Constructor & Destructor Documentation

◆ XFileMesh()

XFileMesh::XFileMesh ( CoordinateSystem cs = CS_yup_left)

Definition at line 35 of file xFileMesh.cxx.

◆ ~XFileMesh()

XFileMesh::~XFileMesh ( )

Definition at line 47 of file xFileMesh.cxx.

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

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

Referenced by fill_material_list(), and XFileFace::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 234 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 139 of file xFileMesh.cxx.

References XFileNormal::set_from_egg().

Referenced by fill_normals(), and XFileFace::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 217 of file xFileMesh.cxx.

◆ add_polygon()

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().

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

References XFileVertex::set_from_egg().

Referenced by fill_mesh(), and XFileFace::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 197 of file xFileMesh.cxx.

◆ clear()

void XFileMesh::clear ( )

Empties all data from the mesh.

Definition at line 55 of file xFileMesh.cxx.

Referenced by fill_mesh().

◆ create_polygons()

bool XFileMesh::create_polygons ( XFileToEggConverter * converter)

◆ fill_colors()

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().

◆ fill_material_list()

bool XFileMesh::fill_material_list ( XFileDataNode * obj)

◆ 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 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().

◆ 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 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().

◆ fill_normals()

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().

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

References XFileDataObject::d(), XFileDataObject::i(), and XFileDataObject::size().

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

References XFileDataObject::size(), and XFileDataObject::vec2().

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 439 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 431 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 405 of file xFileMesh.cxx.

Referenced by make_x_mesh().

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

Referenced by make_x_mesh().

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

Referenced by create_polygons(), and make_x_mesh().

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

Referenced by make_x_mesh().

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

References XFileDataObject::add_IndexedColor(), XFileNode::add_MeshVertexColors(), and XFileDataObject::size().

Referenced by make_x_mesh().

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

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

Referenced by make_x_mesh().

◆ make_x_mesh()

XFileDataNode * XFileMesh::make_x_mesh ( XFileNode * x_parent,
const std::string & suffix )

◆ make_x_normals()

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().

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

References XFileDataObject::add_Coords2d(), XFileNode::add_MeshTextureCoords(), and XFileDataObject::size().

Referenced by make_x_mesh().

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

References EggGroupNode::add_child().


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