Open SamCZ opened 1 year ago
We can also create Asset Manager and it will convert our path to project's path for example: and this manager can also hold paths and resources, for ensuring to use one asset instance (no copies)
AssetManager::GetTexture("Assets/BlaTexture.png");
HashMap<TextureHandle, String> textures;
HashMap<MeshHandle, String> meshes;
HashMap<MaterialHandle, String> materials;
TextureHandle AssetManager::GetTexture(const String& path)
{
String projectPath = ProjectPath / path;
// texture already imported
if (Textures.HasKey(projectPath))
return Textures[projectPath];
TextureHandle texture = ResourceManager::LoadTexture(ProjectPath / path);
Textures.Add(texture);
return texture;
}
Create resource management system