mirror of
https://github.com/sotrh/learn-wgpu.git
synced 2024-11-13 13:10:41 +00:00
fixed #44 fixed $48
This commit is contained in:
parent
5cdce79ffd
commit
8461147ca0
@ -1 +1 @@
|
|||||||
Subproject commit bbc5f48e574cb17ceae63ace67e71e5e19bfe452
|
Subproject commit 16140025e6cff3045a74b0a3f30e45f793e89183
|
@ -396,9 +396,9 @@ pub struct Texture {
|
|||||||
|
|
||||||
impl Texture {
|
impl Texture {
|
||||||
// 1.
|
// 1.
|
||||||
pub fn from_bytes(device: &wgpu::Device, bytes: &[u8]) -> Result<(Self, wgpu::CommandBuffer), failure::Error> {
|
pub fn from_bytes(device: &wgpu::Device, bytes: &[u8], label: &str) -> Result<(Self, wgpu::CommandBuffer), failure::Error> {
|
||||||
let img = image::load_from_memory(bytes)?;
|
let img = image::load_from_memory(bytes)?;
|
||||||
Self::from_image(device, &img)
|
Self::from_image(device, &img, Some(label))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn from_image(device: &wgpu::Device, img: &image::DynamicImage) -> Result<(Self, wgpu::CommandBuffer), failure::Error> {
|
pub fn from_image(device: &wgpu::Device, img: &image::DynamicImage) -> Result<(Self, wgpu::CommandBuffer), failure::Error> {
|
||||||
|
@ -73,7 +73,7 @@ let render_pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescrip
|
|||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
With all that in place we need a model to render. If you have one already that's great, but I've supplied a [zip file](https://github.com/sotrh/learn-wgpu/tree/master/code/beginner/tutorial9-model/src/res) with the model and all of it's textures. We're going to put this model in a new `res` folder.
|
With all that in place we need a model to render. If you have one already that's great, but I've supplied a [zip file](https://github.com/sotrh/learn-wgpu/blob/master/code/beginner/tutorial9-models/src/res/cube.zip) with the model and all of it's textures. We're going to put this model in a new `res` folder.
|
||||||
|
|
||||||
Speaking of textures, let's add a `load()` method to `Texture` in `texture.rs`.
|
Speaking of textures, let's add a `load()` method to `Texture` in `texture.rs`.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user