Files
armorpaint/base/shaders/draw_image.kong
T
2026-04-29 07:30:40 +02:00

44 lines
737 B
Plaintext

#[set(everything)]
const constants: {
empty: float4;
};
#[set(everything)]
const sampler_linear: sampler;
#[set(everything)]
const tex: tex2d;
struct vert_in {
pos: float2;
tex: float2;
col: float4;
}
struct vert_out {
pos: float4;
tex: float2;
col: float4;
}
fun draw_image_vert(input: vert_in): vert_out {
var output: vert_out;
output.pos = float4(input.pos, 0.0, 1.0);
output.tex = input.tex;
output.col = input.col;
return output;
}
fun draw_image_frag(input: vert_out): float4 {
var texcolor: float4 = sample(tex, sampler_linear, input.tex) * input.col;
texcolor.rgb = texcolor.rgb * texcolor.a * input.col.a;
return texcolor;
}
#[pipe]
struct pipe {
vertex = draw_image_vert;
fragment = draw_image_frag;
}