Skip to content

Commit c50e987

Browse files
committed
Add more comments in the example.
1 parent 6bcd1b7 commit c50e987

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

assets/shaders/texture_binding_array.wgsl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ fn fragment(
88
#import bevy_pbr::mesh_vertex_output
99
) -> @location(0) vec4<f32> {
1010
#ifdef VERTEX_UVS
11+
// Select the texture to sample from using non-uniform uv coordinates
1112
let coords = clamp(vec2<u32>(uv * 4.0), vec2<u32>(0u), vec2<u32>(3u));
1213
let index = coords.y * 4u + coords.x;
1314
return textureSample(textures[index], samplers[index], uv * 3.9 + 0.05);

examples/shader/texture_binding_array.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ impl FromWorld for ColorTextures {
3030
fn from_world(world: &mut World) -> Self {
3131
let mut images = world.resource_mut::<Assets<Image>>();
3232

33-
// Create 16 textures with different color gradient
33+
// Create 16 textures with different color gradients
3434
let handles = (1..=MAX_TEXTURE_COUNT)
3535
.map(|id| {
3636
let mut pixel = vec![(256 / id - 1) as u8; 64];
@@ -109,6 +109,7 @@ impl AsBindGroup for BindlessMaterial {
109109
let mut textures: Vec<_> = textures.into_iter().map(|texture| &**texture).collect();
110110
let mut samplers: Vec<_> = samplers.into_iter().map(|sampler| &**sampler).collect();
111111

112+
// Fill in up to the first `MAX_TEXTURE_COUNT` textures and samplers to the arrays
112113
for (id, image) in self
113114
.textures
114115
.iter()

0 commit comments

Comments
 (0)