-
-
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
shader_material manual example #5925
Conversation
@@ -0,0 +1,187 @@ | |||
//! A shader and a material that uses it using Bevy's Material API via manual implementation | |||
//! See shader_material example for a higher level implementation. | |||
//! See shader_material_low_level example for a lower level implementation. |
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.
Not yet implemented, should be removed from this PR
use bevy_internal::render::render_resource::{ | ||
BindGroupLayoutDescriptor, BindGroupLayoutEntry, BindingType, BufferBindingType, | ||
SamplerBindingType, ShaderStages, ShaderType, TextureSampleType, TextureViewDimension, | ||
}; |
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.
probably from cargo-expand, they are probably exposed in render ?
// Step 1: retrieve information from our extracted type. | ||
let color_texture = { | ||
let color_texture_handle: Option<&Handle<Image>> = (&self.color_texture).into(); | ||
if let Some(handle) = color_texture_handle { | ||
images | ||
.get(handle) | ||
.ok_or(AsBindGroupError::RetryNextUpdate)? | ||
} else { | ||
fallback_image | ||
} | ||
}; |
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.
to note: this logic was duplicated with cargo-expand, to get :
- the sampler
- the texture
I refactored a bit to make only one call to retrieve the image and have 1 failure path.
I added a couple of suggestions, mostly to provide a bit more details. Feel free to use them as is or change them. |
Co-authored-by: Charles <[email protected]>
I'm closing this because the example was completely reworked with #8376 |
Objective
Part of #5843.
Solution
I'll try to do a follow up PR with a different example using lower level API: