Update solid.wgsl
This commit is contained in:
parent
eae4065300
commit
8c401be207
1 changed files with 9 additions and 3 deletions
|
|
@ -107,13 +107,19 @@ fn solid_fs_main(
|
|||
let quad_color = vec4<f32>(mixed_color.x, mixed_color.y, mixed_color.z, mixed_color.w * radius_alpha);
|
||||
|
||||
if input.shadow_color.a > 0.0 {
|
||||
let shadow_distance = rounded_box_sdf(input.position.xy - input.pos - input.shadow_offset - (input.scale / 2.0), input.scale / 2.0, border_radius);
|
||||
let shadow_radius = select_border_radius(
|
||||
input.border_radius,
|
||||
input.position.xy - input.shadow_offset,
|
||||
(input.pos + input.scale * 0.5).xy
|
||||
);
|
||||
let shadow_distance = max(rounded_box_sdf(input.position.xy - input.pos - input.shadow_offset - (input.scale / 2.0), input.scale / 2.0, shadow_radius), 0.);
|
||||
|
||||
let shadow_alpha = 1.0 - smoothstep(-input.shadow_blur_radius, input.shadow_blur_radius, shadow_distance);
|
||||
let shadow_color = input.shadow_color;
|
||||
let base_color = select(
|
||||
let base_color = mix(
|
||||
vec4<f32>(shadow_color.x, shadow_color.y, shadow_color.z, 0.0),
|
||||
quad_color,
|
||||
quad_color.a > 0.0
|
||||
quad_color.a
|
||||
);
|
||||
|
||||
return mix(base_color, shadow_color, (1.0 - radius_alpha) * shadow_alpha);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue