Open JameeKim opened 4 years ago
This plan is discarded for now. For more details, see the comment below.
json
, ron
, cbor
, plain text vertext shaders, spv
shaders, ogg
, and mp3
.
As I was trying to build up the first implementation, it turned out that dealing with dynamic asset types was harder than I thought. More specifically, anything else seems to have at least some kind of workarounds regardless of whether clear or dirty, but figuring out what asset type it is for a newly imported asset just seems impossible. Nothing is truly impossible, but I just figured that it is not worth the effort.
Therefore for the first implementation, I will just go with static asset types, and later work on any ways that enable dynamic asset types. The basic structure is the same as the plan above, but the asset type registry is removed.
Full: https://gist.github.com/JameeKim/7b569fcaa7edb4bec73c79407571ac30
How to implement
1.
atelier-assets
Using
atelier-assets
would be the easiest for the first time implementation because it already has a lot of features implemented.Drawbacks
One concern is that
atelier-assets
requires all assets types to manually implementTypeUuid
trait fromtype-uuid
crate. This means that all asset types must be statically declared in the code.For example, one might want to have a new struct type in a scripting language (other than Rust, of course) as an asset type. One workaround is to have, in the Rust code, a type that can be dynamically converted to and from any new asset types. But this is really unfortunate because I love how Rust provides static guarantees in regards to types.
It brings me to the next question though; if we want each asset type to have a unique identifier, would the method
atelier-assets
utilized be the only or the most convenient and effient way? It's definitely not me who can come up with a much better idea in at least a year, but I'll definitely have to think more about this. Also, the workaround does feel kind of hacky, but still works.This limit might also apply to asset loaders, but I haven't checked yet. The loader types use
inventory
crate, which again requires Rust code in order to interact with it. There could be a workaround, but I haven't thought through it yet.2. Manual Implementation
I could make this from scratch, but it is going to take a lot of time. But there are also some benefits, such as that I will learn more about asset processing and managing.