update
This commit is contained in:
@@ -8,6 +8,7 @@ in vec2 frag_dest_half_size;
|
||||
in float frag_softness;
|
||||
in float frag_border_radius;
|
||||
in float frag_border_thickness;
|
||||
in vec4 frag_border_color;
|
||||
|
||||
float roundedRectSDF(vec2 sample_pos, vec2 rect_center, vec2 rect_half_size, float r) {
|
||||
vec2 d2 = (abs(rect_center - sample_pos) - rect_half_size + vec2(r, r));
|
||||
@@ -51,5 +52,6 @@ void main() {
|
||||
|
||||
float sdf_factor = 1 - smoothstep(0, 2*frag_softness, dist);
|
||||
|
||||
pixel_color = frag_color * sample * sdf_factor * border_factor;
|
||||
pixel_color = frag_border_color * sample * sdf_factor * border_factor
|
||||
+ frag_color * sample * sdf_factor;
|
||||
};
|
||||
|
||||
@@ -4,7 +4,8 @@ layout (location = 1) in vec2 p1;
|
||||
layout (location = 2) in vec4 color;
|
||||
layout (location = 3) in float border_radius;
|
||||
layout (location = 4) in float border_thickness;
|
||||
layout (location = 5) in float edge_softness;
|
||||
layout (location = 5) in vec4 border_color;
|
||||
layout (location = 6) in float edge_softness;
|
||||
|
||||
uniform mat4 projection;
|
||||
|
||||
@@ -15,6 +16,7 @@ out vec2 frag_dest_half_size;
|
||||
out float frag_softness;
|
||||
out float frag_border_radius;
|
||||
out float frag_border_thickness;
|
||||
out vec4 frag_border_color;
|
||||
|
||||
const vec2 rectangle_vertices[4] = vec2[](
|
||||
vec2(-1, -1),
|
||||
@@ -40,5 +42,6 @@ void main() {
|
||||
frag_dest_half_size = dest_half_size;
|
||||
frag_border_radius = border_radius;
|
||||
frag_border_thickness = border_thickness;
|
||||
frag_border_color = border_color;
|
||||
frag_softness = edge_softness;
|
||||
}
|
||||
|
||||
@@ -1,24 +1,9 @@
|
||||
#version 330 core
|
||||
layout (location = 0) in vec2 begin;
|
||||
layout (location = 1) in int glyph;
|
||||
layout (location = 2) in float lineHeight;
|
||||
layout (location = 2) in float fontSize;
|
||||
layout (location = 3) in vec4 color;
|
||||
|
||||
/*
|
||||
typedef struct GlyphMeta GlyphMeta;
|
||||
struct GlyphMeta {
|
||||
// chunk 1
|
||||
RLVector2 uv0;
|
||||
RLVector2 uv1;
|
||||
|
||||
// chunk 2
|
||||
real32 xOffset;
|
||||
real32 yOffset;
|
||||
real32 width;
|
||||
real32 height;
|
||||
};
|
||||
*/
|
||||
|
||||
uniform samplerBuffer glyph_table;
|
||||
|
||||
uniform mat4 projection;
|
||||
@@ -57,8 +42,8 @@ void main() {
|
||||
vec2 offset = chunk2.xy;
|
||||
vec2 dims = chunk2.zw;
|
||||
|
||||
vec2 p0 = begin + offset*lineHeight;
|
||||
vec2 p1 = begin + (offset + dims)*lineHeight;
|
||||
vec2 p0 = begin + offset*fontSize;
|
||||
vec2 p1 = begin + (offset + dims)*fontSize;
|
||||
|
||||
vec2 dest_half_size = (p1 - p0) / 2;
|
||||
vec2 dest_center = (p1 + p0) / 2;
|
||||
|
||||
Reference in New Issue
Block a user