Fermat
Classes | Public Types | Public Methods | Proteced Methods | List of all members
MeshLoader Class Reference
Inheritance diagram for MeshLoader:
MeshBase

Classes

struct  AllocateGroupsFunctor
 
struct  AssignMaterialsFunctor
 

Public Types

typedef MeshBase Base
 

Public Methods

 MeshLoader (MeshStorage *mesh)
 
int getVertexTriangleSize () const
 
int getNormalTriangleSize () const
 
int getTextureTriangleSize () const
 
int * getVertexIndices ()
 
const int * getVertexIndices () const
 
int * getNormalIndices ()
 
const int * getNormalIndices () const
 
int * getColorIndices ()
 
const int * getColorIndices () const
 
int * getTextureCoordinateIndices ()
 
const int * getTextureCoordinateIndices () const
 
void setGroupName (const uint32 i, const std::string &group_name)
 
- Public Methods inherited from MeshBase
virtual void loadModel (const std::string &filename, bool insertDefaultMaterial=true, const MeshMaterialParams &defaultMaterial=MeshMaterialParams())
 
template<class Functor >
void forEachGroup (Functor functor) const
 
template<class Functor >
void forEachGroup (Functor functor)
 
int getNumVertices () const
 
int getNumNormals () const
 
int getNumColors () const
 
int getNumTextureCoordinates () const
 
int getNumTriangles () const
 
int getNumGroups () const
 
float * getVertexData ()
 
const float * getVertexData () const
 
float * getNormalData ()
 
const float * getNormalData () const
 
unsigned char * getColorData ()
 
const unsigned char * getColorData () const
 
float * getTextureCoordinateData ()
 
const float * getTextureCoordinateData () const
 
int getVertexStride () const
 
int getNormalStride () const
 
int getColorStride () const
 
int getTextureCoordinateStride () const
 
const float * getBBoxMin () const
 
const float * getBBoxMax () const
 
void updateBBox ()
 
const std::string & getMaterialLibraryName () const
 
MeshGroupgetMeshGroup (const std::string &group_name)
 
const MeshGroupgetMeshGroup (const std::string &group_name) const
 
size_t getMaterialCount () const
 
void setMeshMaterialParams (int i, const MeshMaterialParams &params)
 
MeshMaterialParamsgetMeshMaterialParams (int i)
 
const MeshMaterialParamsgetMeshMaterialParams (int i) const
 
void setMeshGrouping (MeshGrouping grouping)
 
MeshGrouping getMeshGrouping () const
 
void loadFromObj (const std::string &filename, bool insertDefaultMaterial, const MeshMaterialParams &defaultMaterial)
 
void loadMaterials (const std::string &material_filename)
 
void loadFromPly (const std::string &filename, bool insertDefaultMaterial, const MeshMaterialParams &defaultMaterial)
 

Proteced Methods

virtual void preProcess ()
 
virtual void allocateData ()
 
virtual void startWritingData ()
 
virtual void postProcess ()
 
virtual void finishWritingData ()
 
- Proteced Methods inherited from MeshBase
void setVertexData (float *vertex_data)
 
void setNormalData (float *normal_data)
 
void setColorData (unsigned char *color_data)
 
void setTextureCoordinateData (float *texture_coordinate_data)
 
void setMaterialIndices (int *material_indices)
 
void setVertexStride (int vertex_stride)
 
void setNormalStride (int normal_stride)
 
void setColorStride (int color_stride)
 
void setTextureCoordinateStride (int texture_coordinate_stride)
 
void setVertexIndexStride (int index_stride)
 
void setNormalIndexStride (int index_stride)
 
void setColorIndexStride (int index_stride)
 
void setTextureIndexStride (int index_stride)
 
const std::string & getFilename () const
 
const std::string & getPathName () const
 
void computeAabb ()
 

Member Function Documentation

◆ allocateData()

void MeshLoader::allocateData ( )
protectedvirtual

Call this to allocate all data for the mesh after setting num_vertices, num_normals, num_colors, and num_texture_coordinates, as well as num_triangles for all the groups.

Implements MeshBase.

◆ finishWritingData()

void MeshLoader::finishWritingData ( )
protectedvirtual

Call this when done writing to data or group data.

Implements MeshBase.

◆ getVertexTriangleSize()

int MeshLoader::getVertexTriangleSize ( ) const
inlinevirtual

These pure virtual functions allow subclasses to control much about the loading behavior.

Implements MeshBase.

◆ postProcess()

void MeshLoader::postProcess ( )
protectedvirtual

An injection point for subclasses to do load postprocessing

Implements MeshBase.

◆ preProcess()

void MeshLoader::preProcess ( )
protectedvirtual

An injection point for subclasses to do any prep before file info is loaded

Implements MeshBase.

◆ startWritingData()

void MeshLoader::startWritingData ( )
protectedvirtual

Call this before writing any data to the mesh, to set up correct pointer values to write to for vertex_data, normal_data, etc., as well as vertex_indices, normal_indices, etc. for each of the groups.

Call finishWritingData() when done.

Implements MeshBase.


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