Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

XFileMesh Class Reference

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

#include <xFileMesh.h>

Inheritance diagram for XFileMesh:

Namable List of all members.

Public Member Functions

 XFileMesh ()
 ~XFileMesh ()
void clear ()
 Empties all data from the mesh.

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_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_material (EggPrimitive *egg_prim)
 Creates a new XFileMaterial, if one does not already exist for the indicated material, and returns its index.

int add_vertex (XFileVertex *vertex)
 Adds the newly-created XFileVertex unequivocally to the mesh, returning its index number.

int add_normal (XFileNormal *normal)
 Adds the newly-created XFileNormal unequivocally to the mesh, returning its index number.

int add_material (XFileMaterial *material)
 Adds the newly-created XFileMaterial unequivocally to the mesh, returning its index number.

bool create_polygons (EggGroupNode *egg_parent, XFileToEggConverter *converter)
 Creates a slew of EggPolygons according to the faces in the mesh, and adds them to the indicated parent node.

bool has_normals () const
 Returns true if any of the vertices or faces added to this mesh used a normal, false otherwise.

bool has_colors () const
 Returns true if any of the vertices or faces added to this mesh used a color, false otherwise.

bool has_uvs () const
 Returns true if any of the vertices added to this mesh used a texture coordinate, false otherwise.

bool has_materials () const
 Returns true if any of the faces added to this mesh used a real material, false otherwise.

int get_num_materials () const
 Returns the number of distinct materials associated with the mesh.

XFileMaterialget_material (int n) const
 Returns a pointer to the nth materials associated with the mesh.

void make_mesh_data (Datagram &raw_data)
 Fills the datagram with the raw data for the DX Mesh template.

void make_normal_data (Datagram &raw_data)
 Fills the datagram with the raw data for the DX MeshNormals template.

void make_color_data (Datagram &raw_data)
 Fills the datagram with the raw data for the DX MeshVertexColors template.

void make_uv_data (Datagram &raw_data)
 Fills the datagram with the raw data for the DX MeshTextureCoords template.

void make_material_list_data (Datagram &raw_data)
 Fills the datagram with the raw data for the DX MeshMaterialList template.

bool read_mesh_data (const Datagram &raw_data)
 Fills the structure based on the raw data from the Mesh template.

bool read_normal_data (const Datagram &raw_data)
 Fills the structure based on the raw data from the MeshNormals template.

bool read_color_data (const Datagram &raw_data)
 Fills the structure based on the raw data from the MeshVertexColors template.

bool read_uv_data (const Datagram &raw_data)
 Fills the structure based on the raw data from the MeshTextureCoords template.

bool read_material_list_data (const Datagram &raw_data)
 Fills the structure based on the raw data from the MaterialList template.

void set_name (const string &name)
void clear_name ()
bool has_name () const
const string & get_name () const
void output (ostream &out) const

Static Public Member Functions

TypeHandle get_class_type ()
void init_type ()

Protected Attributes

string _name

Static Protected Attributes

TypeHandle _type_handle

Private Types

typedef pvector< XFileVertex * > Vertices
typedef pvector< XFileNormal * > Normals
typedef pvector< XFileMaterial * > Materials
typedef pvector< XFileFace * > Faces
typedef pmap< XFileVertex *,
int, IndirectCompareTo< XFileVertex > > 
UniqueVertices
typedef pmap< XFileNormal *,
int, IndirectCompareTo< XFileNormal > > 
UniqueNormals
typedef pmap< XFileMaterial *,
int, IndirectCompareTo< XFileMaterial > > 
UniqueMaterials

Private Attributes

Vertices _vertices
Normals _normals
Materials _materials
Faces _faces
UniqueVertices _unique_vertices
UniqueNormals _unique_normals
UniqueMaterials _unique_materials
bool _has_normals
bool _has_colors
bool _has_uvs
bool _has_materials

Detailed Description

This is a collection of polygons; i.e.

a polyset.

Definition at line 50 of file xFileMesh.h.


Member Typedef Documentation

typedef pvector<XFileFace *> XFileMesh::Faces [private]
 

Definition at line 93 of file xFileMesh.h.

typedef pvector<XFileMaterial *> XFileMesh::Materials [private]
 

Definition at line 92 of file xFileMesh.h.

typedef pvector<XFileNormal *> XFileMesh::Normals [private]
 

Definition at line 91 of file xFileMesh.h.

typedef pmap<XFileMaterial *, int, IndirectCompareTo<XFileMaterial> > XFileMesh::UniqueMaterials [private]
 

Definition at line 102 of file xFileMesh.h.

typedef pmap<XFileNormal *, int, IndirectCompareTo<XFileNormal> > XFileMesh::UniqueNormals [private]
 

Definition at line 101 of file xFileMesh.h.

typedef pmap<XFileVertex *, int, IndirectCompareTo<XFileVertex> > XFileMesh::UniqueVertices [private]
 

Definition at line 100 of file xFileMesh.h.

typedef pvector<XFileVertex *> XFileMesh::Vertices [private]
 

Definition at line 90 of file xFileMesh.h.


Constructor & Destructor Documentation

XFileMesh::XFileMesh  ) 
 

Definition at line 41 of file xFileMesh.cxx.

XFileMesh::~XFileMesh  ) 
 

Definition at line 56 of file xFileMesh.cxx.

References _normals, and _vertices.


Member Function Documentation

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

References _unique_vertices, and _vertices.

Referenced by XFileToEggConverter::convert_mesh_material_list().

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

References _vertices, and nout.

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

References _has_materials, _materials, _unique_materials, XFileMaterial::has_material(), and XFileMaterial::set_from_egg().

void XFileMesh::add_polygon EggPolygon egg_poly  ) 
 

Adds the indicated polygon to the mesh.

Definition at line 115 of file xFileMesh.cxx.

References XFileVertex::_has_color, _has_colors, XFileVertex::_has_uv, _has_uvs, _unique_vertices, _vertices, and XFileVertex::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 249 of file xFileMesh.cxx.

References _materials, and _unique_materials.

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

Referenced by XFileFace::XFileFace().

void XFileMesh::clear void   ) 
 

Empties all data from the mesh.

Definition at line 69 of file xFileMesh.cxx.

bool XFileMesh::create_polygons EggGroupNode egg_parent,
XFileToEggConverter converter
 

Creates a slew of EggPolygons according to the faces in the mesh, and adds them to the indicated parent node.

Definition at line 313 of file xFileMesh.cxx.

References _materials.

Referenced by XFileToEggConverter::convert_frame().

XFileMaterial * XFileMesh::get_material int  n  )  const
 

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

Definition at line 458 of file xFileMesh.cxx.

References XFileVertex::_color, _vertices, Datagram::add_int32(), Datagram::clear(), and Colorf.

int XFileMesh::get_num_materials  )  const
 

Returns the number of distinct materials associated with the mesh.

Definition at line 443 of file xFileMesh.cxx.

References _faces.

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

References _vertices, and Vertexf.

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

References XFileNormal::_normal, _normals, Datagram::add_float32(), Datagram::add_int32(), Datagram::clear(), and Normalf.

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

References _materials, nassertr, and NULL.

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

void XFileMesh::make_color_data Datagram raw_data  ) 
 

Fills the datagram with the raw data for the DX MeshVertexColors template.

Definition at line 552 of file xFileMesh.cxx.

void XFileMesh::make_material_list_data Datagram raw_data  ) 
 

Fills the datagram with the raw data for the DX MeshMaterialList template.

Definition at line 605 of file xFileMesh.cxx.

References DatagramIterator::get_remaining_size(), and nout.

void XFileMesh::make_mesh_data Datagram raw_data  ) 
 

Fills the datagram with the raw data for the DX Mesh template.

Definition at line 474 of file xFileMesh.cxx.

void XFileMesh::make_normal_data Datagram raw_data  ) 
 

Fills the datagram with the raw data for the DX MeshNormals template.

Definition at line 513 of file xFileMesh.cxx.

References _faces.

void XFileMesh::make_uv_data Datagram raw_data  ) 
 

Fills the datagram with the raw data for the DX MeshTextureCoords template.

Definition at line 581 of file xFileMesh.cxx.

bool XFileMesh::read_color_data const Datagram raw_data  ) 
 

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

Definition at line 727 of file xFileMesh.cxx.

bool XFileMesh::read_material_list_data const Datagram raw_data  ) 
 

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

Definition at line 801 of file xFileMesh.cxx.

bool XFileMesh::read_mesh_data const Datagram raw_data  ) 
 

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

Definition at line 627 of file xFileMesh.cxx.

References _vertices, and nout.

Referenced by XFileToEggConverter::convert_frame().

bool XFileMesh::read_normal_data const Datagram raw_data  ) 
 

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

Definition at line 675 of file xFileMesh.cxx.

bool XFileMesh::read_uv_data const Datagram raw_data  ) 
 

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

Definition at line 765 of file xFileMesh.cxx.

Referenced by XFileToEggConverter::convert_mesh_data_object().


Member Data Documentation

Faces XFileMesh::_faces [private]
 

Definition at line 98 of file xFileMesh.h.

Referenced by get_num_materials(), and make_normal_data().

bool XFileMesh::_has_colors [private]
 

Definition at line 108 of file xFileMesh.h.

Referenced by add_polygon().

bool XFileMesh::_has_materials [private]
 

Definition at line 110 of file xFileMesh.h.

Referenced by add_normal().

bool XFileMesh::_has_normals [private]
 

Definition at line 107 of file xFileMesh.h.

bool XFileMesh::_has_uvs [private]
 

Definition at line 109 of file xFileMesh.h.

Referenced by add_polygon().

Materials XFileMesh::_materials [private]
 

Definition at line 97 of file xFileMesh.h.

Referenced by add_normal(), add_vertex(), create_polygons(), and has_normals().

Normals XFileMesh::_normals [private]
 

Definition at line 96 of file xFileMesh.h.

Referenced by has_materials(), and ~XFileMesh().

UniqueMaterials XFileMesh::_unique_materials [private]
 

Definition at line 105 of file xFileMesh.h.

Referenced by add_normal(), and add_vertex().

UniqueNormals XFileMesh::_unique_normals [private]
 

Definition at line 104 of file xFileMesh.h.

UniqueVertices XFileMesh::_unique_vertices [private]
 

Definition at line 103 of file xFileMesh.h.

Referenced by add_material(), and add_polygon().

Vertices XFileMesh::_vertices [private]
 

Definition at line 95 of file xFileMesh.h.

Referenced by add_material(), add_normal(), add_polygon(), get_material(), has_colors(), read_mesh_data(), and ~XFileMesh().


The documentation for this class was generated from the following files:
Generated on Fri May 2 03:28:10 2003 for Panda-Tool by doxygen1.3