Open RiscadoA opened 3 months ago
After thinking about this a bit further, I came to the conclusion that this might not be such a good idea, as multiple 'source' assets may need to be exported multiple times, with different options. For example, it should be possible to create multiple font atlas assets from a single font asset.
Problem
Our asset flow lacks support for non-trivial asset handling.
The following scenario is a good example of this:
Currently, we can tackle this by providing an
Image
asset type, which loads a.png
or equivalent. Then, on the UI side, we keep aAsset<Image>
field on a component, and the UI code must manually manage the render device texture creation. This is cumbersome and error prone, and this is only one of the examples - we also have a similar situation with voxel grids.Solution
A single asset (UUID) should be able to contain multiple data types. For example, taking the image example once again, we could have two asset types:
Image
, andTexture
. The UI would store anAsset<Texture>
, keeping a reference to only the GPU/render device texture asset. When loading texture data for a given asset, theTextureBridge
load method is called, which internally loads theImage
data of the same asset, and creates a render device texture. As no reference is kept to theImage
data, it can be unloaded, keeping only theTexture
part.To sum it up, we should:
image.png.meta
, justimage.meta
).