#pragma once #include "raylib.h" #include #include enum class ModelSourceType { None, Path, Cube, Sphere, Plane }; struct ModelSource { ModelSourceType type = ModelSourceType::None; std::string path; Vector3 size{1.0f, 1.0f, 1.0f}; float radius = 0.5f; int rings = 16; int slices = 16; }; class ModelManager { public: ModelManager(); ~ModelManager(); // Load a model from a file // Returns a unique ID for the model, or 0 on failure unsigned int Load(const std::string& path); // Load a model from a mesh // Returns a unique ID for the model, or 0 on failure unsigned int LoadFromMesh(Mesh mesh); // Load a model from a generated cube mesh unsigned int LoadCube(float width, float height, float length); // Load a model from a generated sphere mesh unsigned int LoadSphere(float radius, int rings, int slices); // Load a model from a generated plane mesh unsigned int LoadPlane(float width, float length, int resX, int resZ); // Unload a model by ID void Unload(unsigned int id); // Get a model by ID (returns nullptr if not found) Model* Get(unsigned int id); // Get source metadata for a model if available const ModelSource* GetSource(unsigned int id) const; // Unload all models void UnloadAll(); private: std::unordered_map models; std::unordered_map modelSources; unsigned int nextId; bool unloaded; };