gl-transitions
Version:
The open collection of GL Transitions
78 lines (68 loc) • 1.94 kB
text/wgsl
// wipeLeft — WGSL, generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/wipeLeft.glsl
// Author: Jake Nelson
// License: MIT
// Description: A hard-edged wipe from right to left
// Bindings and uniform layout: see the gl-transitions package README
struct Uniforms {
progress: f32,
ratio: f32,
}
var _from: texture_2d<f32>;
var _sampler: sampler;
var _to: texture_2d<f32>;
var<uniform> uniforms: Uniforms;
var<private> _fragColor: vec4<f32>;
var<private> _uv_1: vec2<f32>;
fn getToColor(uv: ptr<function, vec2<f32>>) -> vec4<f32> {
let _e14 = (*uv)[0u];
let _e16 = (*uv)[1u];
let _e19 = textureSampleLevel(_to, _sampler, vec2<f32>(_e14, (1f - _e16)), 0f);
return _e19;
}
fn getFromColor(uv_1: ptr<function, vec2<f32>>) -> vec4<f32> {
let _e14 = (*uv_1)[0u];
let _e16 = (*uv_1)[1u];
let _e19 = textureSampleLevel(_from, _sampler, vec2<f32>(_e14, (1f - _e16)), 0f);
return _e19;
}
fn transition(uv_2: ptr<function, vec2<f32>>) -> vec4<f32> {
var p: vec2<f32>;
var a: vec4<f32>;
var param: vec2<f32>;
var b: vec4<f32>;
var param_1: vec2<f32>;
let _e18 = (*uv_2);
p = (_e18 / vec2<f32>(1f, 1f));
let _e20 = p;
param = _e20;
let _e21 = getFromColor((¶m));
a = _e21;
let _e22 = p;
param_1 = _e22;
let _e23 = getToColor((¶m_1));
b = _e23;
let _e24 = a;
let _e25 = b;
let _e27 = p[0u];
let _e30 = uniforms.progress;
return mix(_e24, _e25, vec4(step((1f - _e27), _e30)));
}
fn main_1() {
var param_2: vec2<f32>;
let _e13 = _uv_1;
param_2 = _e13;
let _e14 = transition((¶m_2));
_fragColor = _e14;
return;
}
fn main( _uv: vec2<f32>) -> vec4<f32> {
_uv_1 = _uv;
main_1();
let _e3 = _fragColor;
return _e3;
}