Skip to content

Commit

Permalink
Restore cursor trail exclusion in cursor region but without branching
Browse files Browse the repository at this point in the history
  • Loading branch information
kovidgoyal committed Dec 12, 2024
1 parent 4b12bff commit 4839233
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion kitty/trail_fragment.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,11 @@ in vec2 frag_pos;
out vec4 final_color;

void main() {
final_color = vec4(trail_color, trail_opacity);
float opacity = trail_opacity;
// Dont render if fragment is within cursor area
float in_x = step(cursor_edge_x[0], frag_pos.x) * step(frag_pos.x, cursor_edge_x[1]);
opacity *= 1.0f - in_x;
float in_y = step(cursor_edge_y[0], frag_pos.y) * step(frag_pos.y, cursor_edge_y[1]);
opacity *= 1.0f - in_y;
final_color = vec4(trail_color, opacity);
}

0 comments on commit 4839233

Please sign in to comment.