This commit is contained in:
Ryan Fleury
2025-11-07 14:47:14 -08:00
parent 920a3ab3b7
commit af423b142e
2 changed files with 10 additions and 2 deletions
@@ -32,7 +32,7 @@ str8_lit_comp(
"in vec4 c2v_colors_2;\n" "in vec4 c2v_colors_2;\n"
"in vec4 c2v_colors_3;\n" "in vec4 c2v_colors_3;\n"
"in vec4 c2v_corner_radii;\n" "in vec4 c2v_corner_radii;\n"
"in vec4 c2v_style; // x: border_thickness_px, y: softness_px, z: omit_texture, w: unused\n" "in vec4 c2v_style; // x: border_thickness_px, y: softness_px, z: omit_texture, w: shear\n"
"\n" "\n"
"out vec2 v2p_sdf_sample_pos;\n" "out vec2 v2p_sdf_sample_pos;\n"
"out vec2 v2p_texcoord_pct;\n" "out vec2 v2p_texcoord_pct;\n"
@@ -51,10 +51,14 @@ str8_lit_comp(
" // rjf: constants\n" " // rjf: constants\n"
" vec2 vertices[] = vec2[](vec2(-1, -1), vec2(-1, +1), vec2(+1, -1), vec2(+1, +1));\n" " vec2 vertices[] = vec2[](vec2(-1, -1), vec2(-1, +1), vec2(+1, -1), vec2(+1, +1));\n"
" \n" " \n"
" // rjf: unpack shears\n"
" float shears[] = float[](0, 0, c2v_style.w, c2v_style.w);\n"
" \n"
" // rjf: find dst position\n" " // rjf: find dst position\n"
" vec2 dst_half_size = (c2v_dst_rect.zw - c2v_dst_rect.xy) / 2;\n" " vec2 dst_half_size = (c2v_dst_rect.zw - c2v_dst_rect.xy) / 2;\n"
" vec2 dst_center = (c2v_dst_rect.zw + c2v_dst_rect.xy) / 2;\n" " vec2 dst_center = (c2v_dst_rect.zw + c2v_dst_rect.xy) / 2;\n"
" vec2 dst_position = vertices[gl_VertexID] * dst_half_size + dst_center;\n" " vec2 dst_position = vertices[gl_VertexID] * dst_half_size + dst_center;\n"
" dst_position.y += shears[gl_VertexID];\n"
" \n" " \n"
" // rjf: find src position\n" " // rjf: find src position\n"
" vec2 src_half_size = (c2v_src_rect.zw - c2v_src_rect.xy) / 2;\n" " vec2 src_half_size = (c2v_src_rect.zw - c2v_src_rect.xy) / 2;\n"
+5 -1
View File
@@ -57,7 +57,7 @@ in vec4 c2v_colors_1;
in vec4 c2v_colors_2; in vec4 c2v_colors_2;
in vec4 c2v_colors_3; in vec4 c2v_colors_3;
in vec4 c2v_corner_radii; in vec4 c2v_corner_radii;
in vec4 c2v_style; // x: border_thickness_px, y: softness_px, z: omit_texture, w: unused in vec4 c2v_style; // x: border_thickness_px, y: softness_px, z: omit_texture, w: shear
out vec2 v2p_sdf_sample_pos; out vec2 v2p_sdf_sample_pos;
out vec2 v2p_texcoord_pct; out vec2 v2p_texcoord_pct;
@@ -76,10 +76,14 @@ void main(void)
// rjf: constants // rjf: constants
vec2 vertices[] = vec2[](vec2(-1, -1), vec2(-1, +1), vec2(+1, -1), vec2(+1, +1)); vec2 vertices[] = vec2[](vec2(-1, -1), vec2(-1, +1), vec2(+1, -1), vec2(+1, +1));
// rjf: unpack shears
float shears[] = float[](0, 0, c2v_style.w, c2v_style.w);
// rjf: find dst position // rjf: find dst position
vec2 dst_half_size = (c2v_dst_rect.zw - c2v_dst_rect.xy) / 2; vec2 dst_half_size = (c2v_dst_rect.zw - c2v_dst_rect.xy) / 2;
vec2 dst_center = (c2v_dst_rect.zw + c2v_dst_rect.xy) / 2; vec2 dst_center = (c2v_dst_rect.zw + c2v_dst_rect.xy) / 2;
vec2 dst_position = vertices[gl_VertexID] * dst_half_size + dst_center; vec2 dst_position = vertices[gl_VertexID] * dst_half_size + dst_center;
dst_position.y += shears[gl_VertexID];
// rjf: find src position // rjf: find src position
vec2 src_half_size = (c2v_src_rect.zw - c2v_src_rect.xy) / 2; vec2 src_half_size = (c2v_src_rect.zw - c2v_src_rect.xy) / 2;