forked from 1b-agent/opencadstudio-upstream
first commit
This commit is contained in:
1 parent
d52c6440ff
commit
d2fdac7f1e
274 files changed
+89330
No files matched your search
@@ -0,0 +1,39 @@
|
||||
struct Uniforms {
|
||||
screen: vec2<f32>,
|
||||
_pad: vec2<f32>,
|
||||
};
|
||||
|
||||
@group(0) @binding(0) var<uniform> u: Uniforms;
|
||||
@group(0) @binding(1) var samp: sampler;
|
||||
@group(0) @binding(2) var tex: texture_2d<f32>;
|
||||
|
||||
struct VsIn {
|
||||
@location(0) pos: vec2<f32>,
|
||||
@location(1) uv: vec2<f32>,
|
||||
@location(2) color: vec4<f32>,
|
||||
};
|
||||
|
||||
struct VsOut {
|
||||
@builtin(position) pos: vec4<f32>,
|
||||
@location(0) uv: vec2<f32>,
|
||||
@location(1) color: vec4<f32>,
|
||||
};
|
||||
|
||||
@vertex
|
||||
fn vs_main(input: VsIn) -> VsOut {
|
||||
var out: VsOut;
|
||||
let ndc = vec2<f32>(
|
||||
(input.pos.x / u.screen.x) * 2.0 - 1.0,
|
||||
1.0 - (input.pos.y / u.screen.y) * 2.0
|
||||
);
|
||||
out.pos = vec4<f32>(ndc, 0.0, 1.0);
|
||||
out.uv = input.uv;
|
||||
out.color = input.color;
|
||||
return out;
|
||||
}
|
||||
|
||||
@fragment
|
||||
fn fs_main(input: VsOut) -> @location(0) vec4<f32> {
|
||||
let a = textureSample(tex, samp, input.uv).r;
|
||||
return vec4<f32>(input.color.rgb, input.color.a * a);
|
||||
}
|
||||
Reference in new issue
Block a user