mirror of
https://github.com/Zenithsiz/zsw.git
synced 2026-02-03 09:50:31 +00:00
Renamed texture to image when referring to a panel's images.
This commit is contained in:
parent
cf42081eaf
commit
39310e0c32
@ -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)`
|
||||
|
||||
@ -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,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user