Fix duplicating fragment position

This commit is contained in:
Dispersia 2021-05-20 23:10:22 -07:00
parent a70715ad9e
commit 0772310c4f
1 changed files with 3 additions and 4 deletions

View File

@ -80,8 +80,7 @@ fn distance_alg(
[[stage(fragment)]] [[stage(fragment)]]
fn fs_main( fn fs_main(
input: VertexOutput, input: VertexOutput
[[builtin(position)]] coord: vec4<f32>
) -> [[location(0)]] vec4<f32> { ) -> [[location(0)]] vec4<f32> {
var mixed_color: vec4<f32> = input.color; var mixed_color: vec4<f32> = input.color;
@ -92,7 +91,7 @@ fn fs_main(
); );
var internal_distance: f32 = distance_alg( var internal_distance: f32 = distance_alg(
vec2<f32>(coord.x, coord.y), vec2<f32>(input.position.x, input.position.y),
input.pos + vec2<f32>(input.border_width, input.border_width), input.pos + vec2<f32>(input.border_width, input.border_width),
input.scale - vec2<f32>(input.border_width * 2.0, input.border_width * 2.0), input.scale - vec2<f32>(input.border_width * 2.0, input.border_width * 2.0),
internal_border internal_border
@ -108,7 +107,7 @@ fn fs_main(
} }
var dist: f32 = distance_alg( var dist: f32 = distance_alg(
vec2<f32>(coord.x, coord.y), vec2<f32>(input.position.x, input.position.y),
input.pos, input.pos,
input.scale, input.scale,
input.border_radius input.border_radius