Blowbox 2017
A 3D Game Engine by Riko Ophorst using DirectX 12
model_factory.h
1 #pragma once
2 
3 #include "util/shared_ptr.h"
4 #include "core/scene/entity.h"
5 
6 struct aiMesh;
7 struct aiNode;
8 
9 namespace blowbox
10 {
19  {
20  public:
27  static SharedPtr<Entity> LoadModel(const String& file_path_to_model);
28 
29  protected:
36  static void ProcessMeshes(aiMesh** meshes, unsigned int num_meshes, Vector<SharedPtr<Mesh>>* out_meshes);
37 
43  static void ProcessVertices(aiMesh* mesh, Vector<Vertex>* out_vertices);
44 
50  static void ProcessIndices(aiMesh* mesh, Vector<Index>* out_indices);
51 
58  static Vector<SharedPtr<Entity>> ProcessNode(aiNode* node, SharedPtr<Entity> parent, const Vector<SharedPtr<Mesh>>& available_meshes);
59  };
60 }
eastl::vector< T > Vector
Typedef for wrapping the EASTL vector.
Definition: vector.h:14
static void ProcessVertices(aiMesh *mesh, Vector< Vertex > *out_vertices)
Converts the vertices in a aiMesh to blowbox vertices.
Definition: model_factory.cc:87
static void ProcessMeshes(aiMesh **meshes, unsigned int num_meshes, Vector< SharedPtr< Mesh >> *out_meshes)
Converts aiMesh objects to blowbox meshes.
Definition: model_factory.cc:63
static void ProcessIndices(aiMesh *mesh, Vector< Index > *out_indices)
Converts the indices in an aiMesh to blowbox vertices.
Definition: model_factory.cc:140
Factory for loading models.
Definition: model_factory.h:18
eastl::string String
Typedef for wrapping the EASTL string.
Definition: string.h:13
static SharedPtr< Entity > LoadModel(const String &file_path_to_model)
Loads a model from disk.
Definition: model_factory.cc:19
The main Blowbox namespace.
Definition: image.cc:8
eastl::shared_ptr< T > SharedPtr
Typedef for wrapping the EASTL shared_ptr.
Definition: shared_ptr.h:14
static Vector< SharedPtr< Entity > > ProcessNode(aiNode *node, SharedPtr< Entity > parent, const Vector< SharedPtr< Mesh >> &available_meshes)
Recursively processes a node. It will output a blowbox Entity.
Definition: model_factory.cc:156