110 - Resource Refactor (Part II)
Channel: StableCoder
Date: 02/07/2021

This session focuses on continuing to refactor how resources work, across the resource objects themselves, their pools and loaders. However, to keep all these fundamental changes managable, only the physics 'collision shape' resource is worked on here.

The first item up was to split out the common resource elements to a base class. This included things like the ID, the load state and reference/use counts. This does result in a change to the behaviour of when resources are loaded. No longer are resources automatically loaded when the use is incremented above zero. As well, the previously created load context/function is joined by the separated 'import context and function.

A new 'isLoading' atomic boolean is also introduced to keep whether a resource is being loaded separate from whether a resource is 'unloaded', 'loaded' or 'failed to load'.

Both the 'import' and 'load' of a resource's data is handled in a completely new manner, with the use of specialized functions parceled out by pools at resource creation. Several new free functions are sprinkled around to facilitate this new pattern, and when loading, all resources will be changed to use the dedicated 'maintenance' phase like components to deal with changing of resource data during simulation loops.

2021/06/22