-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Merged by Bors] - Glb textures should use bevy_render to load images #1454
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! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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> { ... }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok for me!
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
image
frombevy_gltf
, and load the image usingbevy_render
in all cases. I also added support for more mime types while there.