-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Description
Currently, the AssetServer stores its references to handlers as a dictionary of string to box. But the file extension to asset type relationship is not one-to-one -- with GLTF, the file can contain anything from Meshes and Materials to Textures to Skins (aka bones).
In a language with reflection, it would be possible to select handlers depending on the type. While Rust doesn't have true reflection, it does have TypeId which would allow us to match on both AssetLoader type and file extension. This might be a good solution that would also let us preserve the existing API. This could also solve the TODO in the asset server file that mentions that load() needs to be strongly typed.
Another solution that is slightly less ergonomic is to create a load_a method that takes a String specifying the type of the asset we want to load as well as the path.
If we can determine a good path to take, I may be able to implement it, since I am working on something that directly requires this support. (No extra credit for guessing that it's GLTF :D )
Metadata
Metadata
Assignees
Labels
Type
Projects
Status