Blowbox 2017
A 3D Game Engine by Riko Ophorst using DirectX 12
Static Public Member Functions | Static Protected Member Functions | List of all members
blowbox::ModelFactory Class Reference

#include <model_factory.h>

Static Public Member Functions

static SharedPtr< EntityLoadModel (const String &file_path_to_model)
 

Static Protected Member Functions

static void ProcessMeshes (aiMesh **meshes, unsigned int num_meshes, Vector< SharedPtr< Mesh >> *out_meshes)
 
static void ProcessVertices (aiMesh *mesh, Vector< Vertex > *out_vertices)
 
static void ProcessIndices (aiMesh *mesh, Vector< Index > *out_indices)
 
static Vector< SharedPtr< Entity > > ProcessNode (aiNode *node, SharedPtr< Entity > parent, const Vector< SharedPtr< Mesh >> &available_meshes)
 

Detailed Description

Factory for loading models.

This is a very straightforward factory. It allows you to load models from disk of any type that Assimp supports. Models aren't added to the scene, you have to do that yourself via EntityFactory::AddChildToEntity().

Member Function Documentation

SharedPtr< Entity > blowbox::ModelFactory::LoadModel ( const String file_path_to_model)
static

Loads a model from disk.

Parameters
[in]file_path_to_modelA file path to the model that you want to load.
Returns
An entity that sits at the root of the model. Make this Entity a child of any other child to start using it.
void blowbox::ModelFactory::ProcessIndices ( aiMesh *  mesh,
Vector< Index > *  out_indices 
)
staticprotected

Converts the indices in an aiMesh to blowbox vertices.

Parameters
[in]meshThe mesh from which the indices should be processed.
[out]out_indicesThe indices that were converted.
void blowbox::ModelFactory::ProcessMeshes ( aiMesh **  meshes,
unsigned int  num_meshes,
Vector< SharedPtr< Mesh >> *  out_meshes 
)
staticprotected

Converts aiMesh objects to blowbox meshes.

Parameters
[in]meshesThe meshes that should be converted.
[in]num_meshesThe number of meshes in the meshes array.
[out]out_meshesThe meshes that were created.
Vector< SharedPtr< Entity > > blowbox::ModelFactory::ProcessNode ( aiNode *  node,
SharedPtr< Entity parent,
const Vector< SharedPtr< Mesh >> &  available_meshes 
)
staticprotected

Recursively processes a node. It will output a blowbox Entity.

Parameters
[in]nodeThe aiNode that should be processed.
[in]parentThe parent of this node.
[in]available_meshesAn array of meshes from which the meshes should be picked as defined by the node.
void blowbox::ModelFactory::ProcessVertices ( aiMesh *  mesh,
Vector< Vertex > *  out_vertices 
)
staticprotected

Converts the vertices in a aiMesh to blowbox vertices.

Parameters
[in]meshThe mesh from which the vertices should be processed.
[out]out_verticesThe vertices that were converted.

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