forked from yilozt/rounded-window-corners
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor!: refactor the effect directory
Most of the actual code is left unchanged, since there wasn't much to refactor. However, this commit adds a LOT of comments to the code of the fragment shader, as well as some extra documentation in other places. BREAKING CHANGE: GLSLEffect overrides the blending mode, which seemed to cause issues in the past, so the mode had to be manually set to the default value. However, removing this doesn't seem to cause any issues anymore, so it's no longer done. Perhaps this breaks something in the future though.
- Loading branch information
Showing
7 changed files
with
329 additions
and
219 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# `effect` | ||
|
||
This directory contains the code for applying GLSL effects to windows. | ||
|
||
## `clip_shadow_effect.ts` | ||
|
||
Due to a bug in GNOME, window shadows are drawn behind window contents. This | ||
effect loads a simple Fragment shader that clips the shadow behind the window. | ||
|
||
## `linear_filter_effect.ts` | ||
|
||
This effect applies linear interpolation to the window, which makes windows | ||
in the overview look less blurry. | ||
|
||
## `rounded_corners_effect.ts` | ||
|
||
This effect loads the actual Fragment shader that rounds the corners and draws | ||
custom borders for the window. The class applies the effect and provides a | ||
function to change uniforms passed to the effect. | ||
|
||
## `shader` | ||
|
||
This is the directory where the Fragment shaders are stored. | ||
|
||
If you're interested in implementation details of the shader, you can read the | ||
`shader/rounded_corners.frag` file, which is well commented and explains how | ||
it works in great detail. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
// clip shadow in a simple way | ||
// Clip shadows to avoid showing them behind the window contents. | ||
void main() { | ||
vec4 color = cogl_color_out; | ||
float gray = (color.r + color.g + color.b) / 3.0; | ||
cogl_color_out *= (1.0 - smoothstep(0.4, 1.0, gray)) * color.a; | ||
vec4 color = cogl_color_out; | ||
float gray = (color.r + color.g + color.b) / 3.0; | ||
cogl_color_out *= (1.0 - smoothstep(0.4, 1.0, gray)) * color.a; | ||
} |
Oops, something went wrong.