Integrate Asset management with Renderer #52
Comments
I toyed around with a possible asset pipeline and want to share my quick/ugly prototype (unfortunatley requiring nightly features!) https://gist.github.com/anonymous/176941be70ac1747c557ba68c47b56eb Possible pipeline for an asset load request:
AssetStore: A storage (similiar to a package manager), which returns a It should be possible to run the different stages parallel and asynchronous. Interesting would be using the new If the corresponding loader and some asset stores are registered to the asset manager, an assert can be loaded directly by AssetType + an identifier(e.g. file extension) or preloaded by using an identifier only. Example usage (only implemented the actual loading from data to asset): asset_manager.load_asset_from_data::<Mesh, Vec<VertexNormals>>(&vertex_data); // doesn't require storage
asset_manager.load_asset::<Mesh>("obj", &[0; 24])); // raw [u8] data from storage
asset_manager.preload_asset("obj", &[0; 24])); Writing a loader for an combination of Asset + AssetSource: I hope this was helpful to some extent! |
Is the amethyst roadmap aiming for the possibility of hot swapping assets? I consider this an essential feature to speedup iteration cycles and thus increase productivity. Edit: see #43 |
Has the asset manager become too big? It seems like this kind of code should be represented via ecs components and processors, no? https://github.com/amethyst/amethyst/blob/develop/examples/03_renderable/main.rs#L44 This also includes the example above, couldn't/shouldn't the mesh's be components with processors that iterate over them? edit: include "processors" in my sentence. |
Whatever the design is, it needs to support cascading resource loading - currently you can only load one asset per identifier. Asset loaders need to be able to load other assets (ideally only passing the asset store that the loader is loading from). You can, of course, implement this as another parameter to |
@bjadamson: Yeah, I ran into this while working on an nphysics integration demo. Basically, I could load the meshes just fine, but couldn't find a way of extracting them to pass them to the physics processor. Definitely something to consider for whatever solution is chosen. |
@jFransham Good point! A possible solution might be to pass the @mechaxl The currently intended usage is to add the For the moment the asset manager is stored in the context, but this will be changed in future with #133 and #134. Additionally the current Nonetheless, it seems we need to document this part better. I'll try to address it in #134. |
@msiglreith So I added another method to I think the best way to do this would be to have a function that is called before I might implement this if it become necessary, but I'm only making changes that I actually need in my own project for now. |
This issue is outdated as there is new asset management system |
It would be nice if we could abstract away the Textures/Vertex Buffers so that the ECS does not need to retain direct links to the data. The asset manager would be responsible to for loading and unloading assets and provide handles to said assets. That way user code never has to touch
gfx-rs
unless they are directly working on extending the renderer for their game.The text was updated successfully, but these errors were encountered: