From 60f92a8fa8207785e629585ed2e15b966e0a8418 Mon Sep 17 00:00:00 2001
From: StarArawn <toasterthegamer@gmail.com>
Date: Sat, 11 Dec 2021 14:12:14 -0500
Subject: [PATCH] Fixed up shader.

---
 bevy_kayak_ui/src/render/unified/font/extract.rs |  2 +-
 bevy_kayak_ui/src/render/unified/shader.wgsl     | 14 +-------------
 2 files changed, 2 insertions(+), 14 deletions(-)

diff --git a/bevy_kayak_ui/src/render/unified/font/extract.rs b/bevy_kayak_ui/src/render/unified/font/extract.rs
index 7190303..8044f99 100644
--- a/bevy_kayak_ui/src/render/unified/font/extract.rs
+++ b/bevy_kayak_ui/src/render/unified/font/extract.rs
@@ -55,7 +55,7 @@ pub fn extract_texts(
         let chars_layouts = font.get_layout(
             CoordinateSystem::PositiveYDown,
             Alignment::Start,
-            Vec2::new(layout.posx, layout.posy),
+            Vec2::new(layout.posx, layout.posy + font_size),
             Vec2::new(layout.width, layout.height),
             content,
             font_size * 1.2,
diff --git a/bevy_kayak_ui/src/render/unified/shader.wgsl b/bevy_kayak_ui/src/render/unified/shader.wgsl
index c32bbb8..5c23b8d 100644
--- a/bevy_kayak_ui/src/render/unified/shader.wgsl
+++ b/bevy_kayak_ui/src/render/unified/shader.wgsl
@@ -93,19 +93,7 @@ fn fragment(in: VertexOutput) -> [[location(0)]] vec4<f32> {
         var msdf_unit = vec2<f32>(px_range, px_range) / vec2<f32>(f32(tex_dimensions.x), f32(tex_dimensions.y));
         var x = textureSample(font_texture, font_sampler, vec2<f32>(in.uv.x, 1.0 - in.uv.y), i32(in.uv.z)); 
         var v = max(min(x.r, x.g), min(max(x.r, x.g), x.b));
-        var c = v; //remap(v);
-
-        // var v2 = c / fwidth( c );
-        // var a = clamp( v2 + RADIUS, 0.0, 1.0 );
-        // var a = smoothStep(
-        //     max(RADIUS - 0.5, 0.0),
-        //     RADIUS + 0.5,
-        //     c);
-
-        // var w = fwidth(c);
-        // var a = smoothStep(0.5 - w, 0.5 + w, c);
-
-        var sig_dist = (c - 0.5) * dot(msdf_unit, 0.5 / fwidth(in.uv.xy));
+        var sig_dist = (v - 0.5) * dot(msdf_unit, 0.5 / fwidth(in.uv.xy));
         var a = clamp(sig_dist + 0.5, 0.0, 1.0);
 
         return vec4<f32>(in.color.rgb, a);
-- 
GitLab