#ifndef MODELMANAGER_H #define MODELMANAGER_H #include #include "boundingbox.h" #include "render_shared.h" #include #include class GPUBuffer; class Texture2D; struct ModelData_t { GPUBuffer* vb; GPUBuffer* ib; uint32_t vbcount; uint32_t ibcount; }; void ReleaseModelData(ModelData_t& data); class Render; class Model { friend class Render; public: Model(); ~Model(); void LoadObj(const char* filename); void LoadMtl(const char* filename); void Draw(const glm::mat4& model, bool isTransparent = false); const BoundingBox& GetBoundingBox() { return m_boundingBox; } private: std::vector m_Vertices; ModelData_t m_data; BoundingBox m_boundingBox; Texture2D* m_AlbedoTexture; }; class ModelSystem { public: ModelSystem(); ~ModelSystem(); void Init(); void Shutdown(); Model* LoadModel(const char* filename); private: struct ModelEntry { char filename[260]; Model* model; }; std::vector< ModelEntry > m_models; }; extern ModelSystem* g_modelSystem; #endif // !MODELMANAGER_H