Engine
Frameworkcreatedbymeusableforthecreationofsimplegames.CurrentlysupportsOpenGL(Verysimple)andVulkan.
ResourceManager.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "Engine/api.hpp"
4 #include "Engine/Model/Model.hpp"
5 
6 #include <ThirdParty/assimp/include/assimp/Importer.hpp>
7 #include <ThirdParty/assimp/include/assimp/scene.h>
8 #include <ThirdParty/EASTL-master/include/EASTL/map.h>
9 #include <ThirdParty/EASTL-master/include/EASTL/shared_ptr.h>
10 
11 namespace Engine
12 {
17  {
18  public:
24  eastl::weak_ptr<Model> GetModel(eastl::string modelName);
35  eastl::weak_ptr<Model> CreateModel(eastl::string modelName, eastl::string meshToLoad = "", eastl::string skeleton = "");
42  eastl::weak_ptr<Skeleton> CreateSkeleton(eastl::string skeletonToLoad);
52  void AddAnimationsToSkeleton(eastl::string skeletonName, eastl::string animationsToLoad = "", eastl::vector<eastl::string> names = {});
61  eastl::weak_ptr<Mesh> CreateMesh(aiMesh *mesh, eastl::shared_ptr<Skeleton> skeleton, eastl::vector<Vertex> vertices, eastl::vector<unsigned> indices);
68  eastl::weak_ptr<Texture> GetTexture(eastl::string textureName);
75  eastl::weak_ptr<Texture> CreateTexture(eastl::string textureName);
84  eastl::weak_ptr<Texture> CreateTexture(eastl::string textureName, stbi_uc* data, int width, int height);
85 
86  private:
87  friend class Engine;
88  ResourceManager() = default;
89  public:
90  ~ResourceManager() = default;
91  private:
92 
93  friend class Model;
94  void AddTexture(eastl::string textureName, eastl::shared_ptr<Texture> textureToAdd);
95  eastl::weak_ptr<Mesh> GetMesh(eastl::vector<Vertex> vertices, eastl::vector<unsigned> indices);
96  void ProcessModel(eastl::string modelName, eastl::shared_ptr<Model> modelToAddTo, aiNode* node, const aiScene* scene, eastl::shared_ptr<Skeleton> skeleton);
97  eastl::weak_ptr<Mesh> ProcessMesh(aiMesh* mesh, const aiScene* scene, eastl::shared_ptr<Skeleton> skeleton);
98  eastl::vector<eastl::shared_ptr<Texture>> ProcessDiffuseTextures(aiMaterial* material);
99  eastl::vector<eastl::shared_ptr<Texture>> ProcessSpecularTextures(aiMaterial* material);
100  eastl::vector<eastl::shared_ptr<Texture>> LoadMaterialTextures(aiMaterial* material, aiTextureType textureType, eastl::string typeName);
101 
102  eastl::vector<eastl::shared_ptr<Model>> loadedModels_;
103  eastl::vector<eastl::shared_ptr<Skeleton>> loadedSkeletons_;
104  eastl::vector<eastl::shared_ptr<Mesh>> loadedMeshes_;
105  eastl::map<eastl::string, eastl::shared_ptr<Texture>> loadedTextures_;
106  };
107 } // namespace Engine
#define ENGINE_API
Definition: api.hpp:25
This class is used to create models, load in meshes and textures. NOTE: Only the Engine is allowed to...
This object is a storage container for meshes.
Definition: Model.hpp:15