AireEngine
A 3D Open-World Game Engine
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
Aire::MeshManager Class Reference

Mesh manager. Handles mesh creation, storage, and deletion. More...

#include <meshManager.h>

Public Member Functions

 MeshManager (const MeshManager &)=delete
 
MaterialManageroperator= (const MeshManager &)=delete
 
MeshHandle createMesh (std::vector< Vertex > vertices, std::vector< unsigned int > indices, MaterialPtr &handle)
 
ModelHandle createModel (const std::string &path, bool flippedUV=false)
 
void freeModelDataInCpu (const ModelHandle &handle)
 
void moveModelToGpu (const ModelHandle &)
 
void moveModelToGpu (const std::string &)
 
void moveMeshToGpu (const MeshHandle &)
 
void RemoveMeshInGpu (const MeshHandle &)
 
void RemoveMoelInGpu (const ModelHandle &)
 
MeshPtr getMeshPtr (const MeshHandle &)
 
ModelPtr getModelPtr (const ModelHandle &)
 
void SetVertexBoneDataToDefault (Vertex &vertex)
 
void SetVertexBoneData (Vertex &vertex, int boneID, float weight)
 
void ExtractBoneWeightForVertices (std::vector< Vertex > &vertices, aiMesh *mesh, const aiScene *scene, BoneInfoMap &map, int &count)
 

Static Public Member Functions

static MeshManagerget_instance ()
 

Detailed Description

Mesh manager. Handles mesh creation, storage, and deletion.

Member Function Documentation

◆ createMesh()

MeshHandle MeshManager::createMesh ( std::vector< Vertex > vertices,
std::vector< unsigned int > indices,
MaterialPtr & handle )

Create a custom new mesh NOTE: DO NOT call delete on returned pointer. The associated texture will be automatically deleted when the loader goes out of scope.

Parameters
verticesThe vertices of the new mesh
indicesThe indices of the new mesh. All faces are triangles, so every three consecutive indices define a face.
handleThe material of the new mesh
Returns
A handle to the new mesh

◆ createModel()

ModelHandle Aire::MeshManager::createModel ( const std::string & path,
bool flippedUV = false )

Load a new model from a file. .obj readily supported. Other file formats might work. Check Assimp list of supported file formats.

Parameters
pathThe path to the model file to load
flippedUVIf True, the UVs of the created model will be flipped.
Returns
A handle to the new model
Here is the caller graph for this function:

◆ ExtractBoneWeightForVertices()

void Aire::MeshManager::ExtractBoneWeightForVertices ( std::vector< Vertex > & vertices,
aiMesh * mesh,
const aiScene * scene,
BoneInfoMap & map,
int & count )

Extract bone weights for a list of vertices

Parameters
verticesList of vertices to query for
meshThe Assimp mesh
sceneThe Assimp scene
mapThe map mapping bone name to the bone info object
countThe number of bones associated with the vertices
Here is the call graph for this function:

◆ freeModelDataInCpu()

void Aire::MeshManager::freeModelDataInCpu ( const ModelHandle & handle)

Remove a model object from CPU memory

Parameters
handleHandle to the model

◆ getMeshPtr()

MeshPtr Aire::MeshManager::getMeshPtr ( const MeshHandle & handle)

Get pointer to a mesh identified by its handle

Parameters
handleThe handle of the mesh object to query for
Returns
A pointer to the mesh identified with the handle

◆ getModelPtr()

ModelPtr Aire::MeshManager::getModelPtr ( const ModelHandle & handle)

Get pointer to a model identified by its handle

Parameters
handleThe handle of the model object to query for
Returns
A pointer to the model identified with the handle
Here is the caller graph for this function:

◆ moveMeshToGpu()

void Aire::MeshManager::moveMeshToGpu ( const MeshHandle & handle)

Move a mesh to GPU memory

Parameters
handleHandle to identify the mesh

◆ moveModelToGpu() [1/2]

void Aire::MeshManager::moveModelToGpu ( const ModelHandle & handle)

Move a model to GPU memory

Parameters
handleHandle to identify the model
Here is the caller graph for this function:

◆ moveModelToGpu() [2/2]

void Aire::MeshManager::moveModelToGpu ( const std::string & path)

Move a model to GPU memory (identified by model path)

Parameters
pathPath from which the model was loaded as an identifier

◆ RemoveMeshInGpu()

void Aire::MeshManager::RemoveMeshInGpu ( const MeshHandle & handle)

Remove a mesh object from GPU memory

Parameters
handleHandle to identify the mesh

◆ RemoveMoelInGpu()

void Aire::MeshManager::RemoveMoelInGpu ( const ModelHandle & handle)

Remove a model object from GPU memory

Parameters
handleHandle to identify the model

◆ SetVertexBoneData()

void Aire::MeshManager::SetVertexBoneData ( Vertex & vertex,
int boneID,
float weight )

Set the bone data for a vertex

Parameters
vertexThe vertex to set bone data for
boneIDThe ID to link to the vertex
weightThe weight associated with the bone

◆ SetVertexBoneDataToDefault()

void Aire::MeshManager::SetVertexBoneDataToDefault ( Vertex & vertex)

Clear the bone data associated with a vertex

Parameters
vertexThe vertex to reset bone data on

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