Brewing-Team / Coffee-Engine

A little game engine brewed for learning how to brew a game engine!
https://brewing-team.github.io/Coffee-Engine/
MIT License
2 stars 0 forks source link

Resource Management Implementation #16

Open mdoradom opened 1 month ago

mdoradom commented 1 month ago

The Resource Management Structure will consist in the next management structures:

Pseudocode:


// Resource Loader
Ref<T> ResourceLoader::Load(path)
{
    //detect resource type
   if(ResourceRegistry::Exist(resource))
   {
        return resource;
   }
    else
    {
          resource r = ResourceImporter....
          ResourceRegistry::Add(r)
          return r;
    }
}

//Resource Importer

//Check if the imported resource is cached...
//If not cache it and load it
if is cached load the cached file

//Usage Example

        Ref<Texture> a = ResourceLoader::Load<Texture>(path);
HugoPlacer commented 1 month ago

The base of the Resource Management is implemented. Few things that are missing:

HugoPlacer commented 3 weeks ago

After a lot of tears and pain I managed to refactor the Resource Management to cover all the Coffee Engine needs. The Templates are gone. A ResouceSaver and a CacheManager has been added and the ResouceImporter is no longer a static class but it is part of the ResouceLoader.

Even so, there are still some things to polish:

HugoPlacer commented 1 week ago

To better manage the Resources that are only owned by the Resource Manager are not removed. I'm in some ways to solve it.

HugoPlacer commented 1 week ago

I think we need to add UUID's to the Resource Manager to be able to serialize the meshes

HugoPlacer commented 1 week ago
HugoPlacer commented 1 week ago

Two new problems I have encountered today. Today I added that when the LoadDirectory is called generates all the .import files of the project. Then the Resource Loading uses the .import instead of the original file for loading.

I can't handle this anymore. I fucking hate the Resource Management, is unbearable. Is a rabbit hole of problems. Is the less satisfying thing I made in my entire life. Being executed with the Garrote Vil is better than this shit.

HugoPlacer commented 5 days ago

I embedded all the CoffeeEngine Shaders in the source code. Is missing the texture and the TextMesh.glb.

The .import system is working!!! When the .import is created the original file is no longer need it. With the Model does not work bc the Model is not in the cache.

Add to the LoadDirectory to eary test if the file has a .import? ...