I'm in the process of redoing my asset/resource manager currently I have load functions scattered throughout my code for example LoadMeshFromFile(), LoadTextureFromFile(), LoadShaderFromFile(), etc, which then get added to the resource manager AddResource(Resource resource) with my new code I'm hoping to just have a single load function like LoadResource<Mesh>("path/to/mesh") or LoadResource("path/to/mesh", ResourceType::Mesh) also instead of working with strings it uses handles.
The problem I'm facing is not knowing how to actually load the individual resources if it's a mesh how do I load a mesh, if it's a texture how do I load that, etc.
ResourceHandle LoadAsset(const std::string& filepath) {
// Check if the filepath is valid
// Check if the resource already exists
// Create handle
auto resource = std::make_shared<Resource>();
ResourceHandle handle(nextId++);
resources[handle.GetID()] = resource;
filePathToHandle[filepath] = handle.GetID();
return handle;
}