Renamed texture to image when referring to a panel's images.

This commit is contained in:
Filipe Rodrigues 2025-09-17 09:33:36 +01:00
parent cf42081eaf
commit 39310e0c32
Signed by: zenithsiz
SSH Key Fingerprint: SHA256:Mb5ppb3Sh7IarBO/sBTXLHbYEOz37hJAlslLQPPAPaU
2 changed files with 14 additions and 14 deletions

View File

@ -5,18 +5,18 @@
#import fade::uniforms::{uniforms, ImageUniforms}
// Bindings
@group(1) @binding(0) var texture_prev: texture_2d<f32>;
@group(1) @binding(1) var texture_cur: texture_2d<f32>;
@group(1) @binding(2) var texture_next: texture_2d<f32>;
@group(1) @binding(3) var texture_sampler: sampler;
@group(1) @binding(0) var image_prev: texture_2d<f32>;
@group(1) @binding(1) var image_cur: texture_2d<f32>;
@group(1) @binding(2) var image_next: texture_2d<f32>;
@group(1) @binding(3) var image_sampler: sampler;
struct Sampled {
color: vec4<f32>,
uvs : vec2<f32>,
}
// Samples a texture
fn sample(texture: texture_2d<f32>, in_uvs: vec2<f32>, image_uniforms: ImageUniforms, progress_raw: f32, alpha: f32) -> Sampled {
// Samples an image
fn sample(image: texture_2d<f32>, in_uvs: vec2<f32>, image_uniforms: ImageUniforms, progress_raw: f32, alpha: f32) -> Sampled {
var sampled: Sampled;
var uvs = in_uvs;
@ -42,7 +42,7 @@ fn sample(texture: texture_2d<f32>, in_uvs: vec2<f32>, image_uniforms: ImageUnif
#endif
sampled.color = textureSample(texture, texture_sampler, uvs);
sampled.color = textureSample(image, image_sampler, uvs);
sampled.uvs = uvs;
return sampled;
@ -65,10 +65,10 @@ fn main(in: VertexOutput) -> FragOutput {
let alpha_next = 0.5 * saturate(1.0 - (1.0 - p) / f);
let alpha_cur = 1.0 - max(alpha_prev, alpha_next);
// Sample the textures
let sample_prev = sample(texture_prev, in.uvs, uniforms.prev, progress_prev, alpha_prev);
let sample_cur = sample( texture_cur, in.uvs, uniforms.cur , progress_cur , alpha_cur );
let sample_next = sample(texture_next, in.uvs, uniforms.next, progress_next, alpha_next);
// Sample the images
let sample_prev = sample(image_prev, in.uvs, uniforms.prev, progress_prev, alpha_prev);
let sample_cur = sample( image_cur, in.uvs, uniforms.cur , progress_cur , alpha_cur );
let sample_next = sample(image_next, in.uvs, uniforms.next, progress_next, alpha_next);
// Then mix the color
// TODO: Don't repeat this once we're able to use `defined(FADE_BASIC) || defined(FADE_OUT)`

View File

@ -40,10 +40,10 @@ pub struct PanelFadeImages {
/// Next image
pub next: Option<PanelFadeImage>,
/// Texture sampler
/// Image sampler
pub image_sampler: OnceCell<wgpu::Sampler>,
/// Texture bind group
/// Image bind group
pub image_bind_group: OnceCell<wgpu::BindGroup>,
/// Next image
@ -338,7 +338,7 @@ fn create_bind_group_layout(wgpu: &Wgpu) -> wgpu::BindGroupLayout {
wgpu.device.create_bind_group_layout(&descriptor)
}
/// Creates the texture bind group
/// Creates the image bind group
fn create_image_bind_group(
wgpu: &Wgpu,
bind_group_layout: &wgpu::BindGroupLayout,