[Merged by Bors] - Glb textures should use bevy_render to load images#1454
[Merged by Bors] - Glb textures should use bevy_render to load images#1454mockersf wants to merge 4 commits into
Conversation
|
Fails to build on wasm because module to load images in bevy_render is behind features... Currently, it works as a side effect because, when enabling feature Possible fixes:
What do you think? |
|
after doing some tests, I didn't notice a slowdown of compilation time by removing the feature check so I went this way |
|
Yeah I think you made the right call for "image features". Looking now! |
cart
left a comment
There was a problem hiding this comment.
This is a good change ❤️
Just one small point of discussion
| } | ||
|
|
||
| /// Load a bytes buffer in a [`Texture`], according to type `image_type`, using the `image` crate` | ||
| pub fn buffer_to_texture(buffer: &[u8], image_type: ImageType) -> Result<Texture, TextureError> { |
There was a problem hiding this comment.
Rather than being a floating function, maybe this should be added to Texture? Ex:
Texture::from_buffer(buffer: &[u8], image_type: ImageType) -> Result<Texture, TextureError> { ... }|
bors r+ |
Fixes #1396 <img width="1392" alt="Screenshot 2021-02-16 at 02 24 01" src="https://user-images.githubusercontent.com/8672791/108011774-1b991a80-7008-11eb-979e-6ebfc51fba3c.png"> Issue was that, when loading an image directly from its bytes in the binary glb file, it didn't follow the same flow as when loaded as a texture file. This PR removes the dependency to `image` from `bevy_gltf`, and load the image using `bevy_render` in all cases. I also added support for more mime types while there. <img width="1392" alt="Screenshot 2021-02-16 at 02 44 56" src="https://user-images.githubusercontent.com/8672791/108011915-674bc400-7008-11eb-83d4-ded96a38919b.png">
|
Pull request successfully merged into main. Build succeeded: |
Fixes #1396
Issue was that, when loading an image directly from its bytes in the binary glb file, it didn't follow the same flow as when loaded as a texture file. This PR removes the dependency to
imagefrombevy_gltf, and load the image usingbevy_renderin all cases. I also added support for more mime types while there.